User Guide
all.hpp
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright (C) 2018-2019 Blue Brain Project
3  *
4  * This file is part of NMODL distributed under the terms of the GNU
5  * Lesser General Public License. See top-level LICENSE file for details.
6  *************************************************************************/
7 
8 ///
9 /// THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
10 ///
11 
12 #pragma once
13 
14 /**
15  * \dir
16  * \brief Auto generated AST Implementations
17  *
18  * \file
19  * \brief Auto generated AST classes declaration
20  */
21 
22 #include "ast/ast.hpp"
23 
24 #ifndef NMODL_AST_NODE_HPP
25 #define NMODL_AST_NODE_HPP
26 
27 namespace nmodl {
28 namespace ast {
29 
30 /**
31  * @addtogroup ast_class
32  * @ingroup ast
33  * @{
34  */
35 
36 /**
37  * \brief Base class for all AST node
38  *
39  * Base class for all nodes in the AST. This can replace ast::Ast in
40  * the next refactoring.
41  *
42  */
43 class Node : public Ast {
44 
45 public:
46  /// \name Ctor & dtor
47  /// \{
48 
49  virtual ~Node() = default;
50 
51  /// \}
52 
53  /**
54  * \brief Check if the ast node is an instance of ast::Node
55  * \return true as object is of type ast::Node
56  */
57  bool is_node() const noexcept override { return true; }
58 
59  /**
60  * \brief Return a copy of the current node
61  *
62  * Recursively make a new copy/clone of the current node including
63  * all members and return a pointer to the node. This is used for
64  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
65  * ast.
66  *
67  * @return pointer to the clone/copy of the current node
68  */
69  virtual Node *clone() const override { return new Node(*this); }
70 
71  /// \name Getters
72  /// \{
73 
74  /**
75  * \brief Return type (ast::AstNodeType) of ast node
76  *
77  * Every node in the ast has a type defined in ast::AstNodeType and this
78  * function is used to retrieve the same.
79  *
80  * \return ast node type i.e. ast::AstNodeType::NODE
81  *
82  * \sa Ast::get_node_type_name
83  */
84  virtual AstNodeType get_node_type() const noexcept override {
85  return AstNodeType::NODE;
86  }
87 
88  /**
89  * \brief Return type (ast::AstNodeType) of ast node as std::string
90  *
91  * Every node in the ast has a type defined in ast::AstNodeType.
92  * This type name can be returned as a std::string for printing
93  * node to text/json form.
94  *
95  * \return name of the node type as a string i.e. "Node"
96  *
97  * \sa Ast::get_node_name
98  */
99  virtual std::string get_node_type_name() const noexcept override {
100  return "Node";
101  }
102 
103  /**
104  * \brief Get std::shared_ptr from `this` pointer of the current ast node
105  */
106  virtual std::shared_ptr<Ast> get_shared_ptr() override {
107  return std::static_pointer_cast<Node>(shared_from_this());
108  }
109 
110  /**
111  * \brief Get std::shared_ptr from `this` pointer of the current ast node
112  */
113  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
114  return std::static_pointer_cast<const Node>(shared_from_this());
115  }
116 
117  /// \}
118 
119  /// \name Visitor
120  /// \{
121 
122  /**
123  * \brief visit children i.e. member variables of current node using provided
124  * visitor
125  *
126  * Different nodes in the AST have different members (i.e. children). This
127  * method recursively visits children using provided visitor.
128  *
129  * \param v Concrete visitor that will be used to recursively visit children
130  *
131  * \sa Ast::visit_children for example.
132  */
133  virtual void visit_children(visitor::Visitor &v) override;
134 
135  /**
136  * \brief accept (or visit) the current AST node using provided visitor
137  *
138  * Instead of visiting children of AST node, like Ast::visit_children,
139  * accept allows to visit the current node itself using provided concrete
140  * visitor.
141  *
142  * \param v Concrete visitor that will be used to recursively visit node
143  *
144  * \sa Ast::accept for example.
145  */
146  virtual void accept(visitor::Visitor &v) override;
147 
148  /// \}
149 };
150 
151 /** @} */ // end of ast_class
152 
153 } // namespace ast
154 } // namespace nmodl
155 #endif // !NMODL_AST_NODE_HPP
156 #ifndef NMODL_AST_STATEMENT_HPP
157 #define NMODL_AST_STATEMENT_HPP
158 
159 namespace nmodl {
160 namespace ast {
161 
162 /**
163  * @addtogroup ast_class
164  * @ingroup ast
165  * @{
166  */
167 
168 /**
169  * \brief TODO
170  *
171  *
172  */
173 class Statement : public Node {
174 
175 public:
176  /// \name Ctor & dtor
177  /// \{
178 
179  virtual ~Statement() = default;
180 
181  /// \}
182 
183  /**
184  * \brief Check if the ast node is an instance of ast::Statement
185  * \return true as object is of type ast::Statement
186  */
187  bool is_statement() const noexcept override { return true; }
188 
189  /**
190  * \brief Return a copy of the current node
191  *
192  * Recursively make a new copy/clone of the current node including
193  * all members and return a pointer to the node. This is used for
194  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
195  * ast.
196  *
197  * @return pointer to the clone/copy of the current node
198  */
199  virtual Statement *clone() const override { return new Statement(*this); }
200 
201  /// \name Getters
202  /// \{
203 
204  /**
205  * \brief Return type (ast::AstNodeType) of ast node
206  *
207  * Every node in the ast has a type defined in ast::AstNodeType and this
208  * function is used to retrieve the same.
209  *
210  * \return ast node type i.e. ast::AstNodeType::STATEMENT
211  *
212  * \sa Ast::get_node_type_name
213  */
214  virtual AstNodeType get_node_type() const noexcept override {
215  return AstNodeType::STATEMENT;
216  }
217 
218  /**
219  * \brief Return type (ast::AstNodeType) of ast node as std::string
220  *
221  * Every node in the ast has a type defined in ast::AstNodeType.
222  * This type name can be returned as a std::string for printing
223  * node to text/json form.
224  *
225  * \return name of the node type as a string i.e. "Statement"
226  *
227  * \sa Ast::get_node_name
228  */
229  virtual std::string get_node_type_name() const noexcept override {
230  return "Statement";
231  }
232 
233  /**
234  * \brief Get std::shared_ptr from `this` pointer of the current ast node
235  */
236  virtual std::shared_ptr<Ast> get_shared_ptr() override {
237  return std::static_pointer_cast<Statement>(shared_from_this());
238  }
239 
240  /**
241  * \brief Get std::shared_ptr from `this` pointer of the current ast node
242  */
243  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
244  return std::static_pointer_cast<const Statement>(shared_from_this());
245  }
246 
247  /// \}
248 
249  /// \name Visitor
250  /// \{
251 
252  /**
253  * \brief visit children i.e. member variables of current node using provided
254  * visitor
255  *
256  * Different nodes in the AST have different members (i.e. children). This
257  * method recursively visits children using provided visitor.
258  *
259  * \param v Concrete visitor that will be used to recursively visit children
260  *
261  * \sa Ast::visit_children for example.
262  */
263  virtual void visit_children(visitor::Visitor &v) override;
264 
265  /**
266  * \brief accept (or visit) the current AST node using provided visitor
267  *
268  * Instead of visiting children of AST node, like Ast::visit_children,
269  * accept allows to visit the current node itself using provided concrete
270  * visitor.
271  *
272  * \param v Concrete visitor that will be used to recursively visit node
273  *
274  * \sa Ast::accept for example.
275  */
276  virtual void accept(visitor::Visitor &v) override;
277 
278  /// \}
279 };
280 
281 /** @} */ // end of ast_class
282 
283 } // namespace ast
284 } // namespace nmodl
285 #endif // !NMODL_AST_STATEMENT_HPP
286 #ifndef NMODL_AST_EXPRESSION_HPP
287 #define NMODL_AST_EXPRESSION_HPP
288 
289 namespace nmodl {
290 namespace ast {
291 
292 /**
293  * @addtogroup ast_class
294  * @ingroup ast
295  * @{
296  */
297 
298 /**
299  * \brief Base class for all expressions in the NMODL
300  *
301  * Base class for all expression types. This is one of the top level node
302  * in the AST representing higher level expression constructs. %Expressions
303  * can be a variable itself or complex binary expressions.
304  *
305  * \sa ast::Statement
306  *
307  */
308 class Expression : public Node {
309 
310 public:
311  /// \name Ctor & dtor
312  /// \{
313 
314  virtual ~Expression() = default;
315 
316  /// \}
317 
318  /**
319  * \brief Check if the ast node is an instance of ast::Expression
320  * \return true as object is of type ast::Expression
321  */
322  bool is_expression() const noexcept override { return true; }
323 
324  /**
325  * \brief Return a copy of the current node
326  *
327  * Recursively make a new copy/clone of the current node including
328  * all members and return a pointer to the node. This is used for
329  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
330  * ast.
331  *
332  * @return pointer to the clone/copy of the current node
333  */
334  virtual Expression *clone() const override { return new Expression(*this); }
335 
336  /// \name Getters
337  /// \{
338 
339  /**
340  * \brief Return type (ast::AstNodeType) of ast node
341  *
342  * Every node in the ast has a type defined in ast::AstNodeType and this
343  * function is used to retrieve the same.
344  *
345  * \return ast node type i.e. ast::AstNodeType::EXPRESSION
346  *
347  * \sa Ast::get_node_type_name
348  */
349  virtual AstNodeType get_node_type() const noexcept override {
351  }
352 
353  /**
354  * \brief Return type (ast::AstNodeType) of ast node as std::string
355  *
356  * Every node in the ast has a type defined in ast::AstNodeType.
357  * This type name can be returned as a std::string for printing
358  * node to text/json form.
359  *
360  * \return name of the node type as a string i.e. "Expression"
361  *
362  * \sa Ast::get_node_name
363  */
364  virtual std::string get_node_type_name() const noexcept override {
365  return "Expression";
366  }
367 
368  /**
369  * \brief Get std::shared_ptr from `this` pointer of the current ast node
370  */
371  virtual std::shared_ptr<Ast> get_shared_ptr() override {
372  return std::static_pointer_cast<Expression>(shared_from_this());
373  }
374 
375  /**
376  * \brief Get std::shared_ptr from `this` pointer of the current ast node
377  */
378  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
379  return std::static_pointer_cast<const Expression>(shared_from_this());
380  }
381 
382  /// \}
383 
384  /// \name Visitor
385  /// \{
386 
387  /**
388  * \brief visit children i.e. member variables of current node using provided
389  * visitor
390  *
391  * Different nodes in the AST have different members (i.e. children). This
392  * method recursively visits children using provided visitor.
393  *
394  * \param v Concrete visitor that will be used to recursively visit children
395  *
396  * \sa Ast::visit_children for example.
397  */
398  virtual void visit_children(visitor::Visitor &v) override;
399 
400  /**
401  * \brief accept (or visit) the current AST node using provided visitor
402  *
403  * Instead of visiting children of AST node, like Ast::visit_children,
404  * accept allows to visit the current node itself using provided concrete
405  * visitor.
406  *
407  * \param v Concrete visitor that will be used to recursively visit node
408  *
409  * \sa Ast::accept for example.
410  */
411  virtual void accept(visitor::Visitor &v) override;
412 
413  /// \}
414 };
415 
416 /** @} */ // end of ast_class
417 
418 } // namespace ast
419 } // namespace nmodl
420 #endif // !NMODL_AST_EXPRESSION_HPP
421 #ifndef NMODL_AST_BLOCK_HPP
422 #define NMODL_AST_BLOCK_HPP
423 
424 namespace nmodl {
425 namespace ast {
426 
427 /**
428  * @addtogroup ast_class
429  * @ingroup ast
430  * @{
431  */
432 
433 /**
434  * \brief Base class for all block scoped nodes
435  *
436  * NMODL has different local and global block scoped nodes like
437  * ast::NeuronBlock, ast::ParamBlock, ast::IfStatement etc. Ast::Block
438  * is base class and defines common interface for these nodes.
439  *
440  */
441 class Block : public Expression {
442 
443 public:
444  /// \name Ctor & dtor
445  /// \{
446 
447  virtual ~Block() = default;
448 
449  /// \}
450 
451  /// \name Not implemented
452  /// \{
453 
454  virtual const ArgumentVector &get_parameters() const {
455  throw std::runtime_error("get_parameters not implemented");
456  }
457 
458  /// \}
459 
460  /**
461  * \brief Check if the ast node is an instance of ast::Block
462  * \return true as object is of type ast::Block
463  */
464  bool is_block() const noexcept override { return true; }
465 
466  /**
467  * \brief Return a copy of the current node
468  *
469  * Recursively make a new copy/clone of the current node including
470  * all members and return a pointer to the node. This is used for
471  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
472  * ast.
473  *
474  * @return pointer to the clone/copy of the current node
475  */
476  virtual Block *clone() const override { return new Block(*this); }
477 
478  /// \name Getters
479  /// \{
480 
481  /**
482  * \brief Return type (ast::AstNodeType) of ast node
483  *
484  * Every node in the ast has a type defined in ast::AstNodeType and this
485  * function is used to retrieve the same.
486  *
487  * \return ast node type i.e. ast::AstNodeType::BLOCK
488  *
489  * \sa Ast::get_node_type_name
490  */
491  virtual AstNodeType get_node_type() const noexcept override {
492  return AstNodeType::BLOCK;
493  }
494 
495  /**
496  * \brief Return type (ast::AstNodeType) of ast node as std::string
497  *
498  * Every node in the ast has a type defined in ast::AstNodeType.
499  * This type name can be returned as a std::string for printing
500  * node to text/json form.
501  *
502  * \return name of the node type as a string i.e. "Block"
503  *
504  * \sa Ast::get_node_name
505  */
506  virtual std::string get_node_type_name() const noexcept override {
507  return "Block";
508  }
509 
510  /**
511  * \brief Get std::shared_ptr from `this` pointer of the current ast node
512  */
513  virtual std::shared_ptr<Ast> get_shared_ptr() override {
514  return std::static_pointer_cast<Block>(shared_from_this());
515  }
516 
517  /**
518  * \brief Get std::shared_ptr from `this` pointer of the current ast node
519  */
520  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
521  return std::static_pointer_cast<const Block>(shared_from_this());
522  }
523 
524  /// \}
525 
526  /// \name Visitor
527  /// \{
528 
529  /**
530  * \brief visit children i.e. member variables of current node using provided
531  * visitor
532  *
533  * Different nodes in the AST have different members (i.e. children). This
534  * method recursively visits children using provided visitor.
535  *
536  * \param v Concrete visitor that will be used to recursively visit children
537  *
538  * \sa Ast::visit_children for example.
539  */
540  virtual void visit_children(visitor::Visitor &v) override;
541 
542  /**
543  * \brief accept (or visit) the current AST node using provided visitor
544  *
545  * Instead of visiting children of AST node, like Ast::visit_children,
546  * accept allows to visit the current node itself using provided concrete
547  * visitor.
548  *
549  * \param v Concrete visitor that will be used to recursively visit node
550  *
551  * \sa Ast::accept for example.
552  */
553  virtual void accept(visitor::Visitor &v) override;
554 
555  /// \}
556 };
557 
558 /** @} */ // end of ast_class
559 
560 } // namespace ast
561 } // namespace nmodl
562 #endif // !NMODL_AST_BLOCK_HPP
563 #ifndef NMODL_AST_IDENTIFIER_HPP
564 #define NMODL_AST_IDENTIFIER_HPP
565 
566 namespace nmodl {
567 namespace ast {
568 
569 /**
570  * @addtogroup ast_class
571  * @ingroup ast
572  * @{
573  */
574 
575 /**
576  * \brief Base class for all identifiers
577  *
578  * Base class for all variable types like ast::Name, ast::PrimeName and
579  * ast::Argument.
580  *
581  * \sa ast::Number
582  *
583  */
584 class Identifier : public Expression {
585 
586 public:
587  /// \name Ctor & dtor
588  /// \{
589 
590  virtual ~Identifier() = default;
591 
592  /// \}
593 
594  /**
595  * \brief Check if the ast node is an instance of ast::Identifier
596  * \return true as object is of type ast::Identifier
597  */
598  bool is_identifier() const noexcept override { return true; }
599 
600  /**
601  * \brief Return a copy of the current node
602  *
603  * Recursively make a new copy/clone of the current node including
604  * all members and return a pointer to the node. This is used for
605  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
606  * ast.
607  *
608  * @return pointer to the clone/copy of the current node
609  */
610  virtual Identifier *clone() const override { return new Identifier(*this); }
611 
612  /// \name Getters
613  /// \{
614 
615  /**
616  * \brief Return type (ast::AstNodeType) of ast node
617  *
618  * Every node in the ast has a type defined in ast::AstNodeType and this
619  * function is used to retrieve the same.
620  *
621  * \return ast node type i.e. ast::AstNodeType::IDENTIFIER
622  *
623  * \sa Ast::get_node_type_name
624  */
625  virtual AstNodeType get_node_type() const noexcept override {
627  }
628 
629  /**
630  * \brief Return type (ast::AstNodeType) of ast node as std::string
631  *
632  * Every node in the ast has a type defined in ast::AstNodeType.
633  * This type name can be returned as a std::string for printing
634  * node to text/json form.
635  *
636  * \return name of the node type as a string i.e. "Identifier"
637  *
638  * \sa Ast::get_node_name
639  */
640  virtual std::string get_node_type_name() const noexcept override {
641  return "Identifier";
642  }
643 
644  /**
645  * \brief Get std::shared_ptr from `this` pointer of the current ast node
646  */
647  virtual std::shared_ptr<Ast> get_shared_ptr() override {
648  return std::static_pointer_cast<Identifier>(shared_from_this());
649  }
650 
651  /**
652  * \brief Get std::shared_ptr from `this` pointer of the current ast node
653  */
654  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
655  return std::static_pointer_cast<const Identifier>(shared_from_this());
656  }
657 
658  /// \}
659 
660  /// \name Visitor
661  /// \{
662 
663  /**
664  * \brief visit children i.e. member variables of current node using provided
665  * visitor
666  *
667  * Different nodes in the AST have different members (i.e. children). This
668  * method recursively visits children using provided visitor.
669  *
670  * \param v Concrete visitor that will be used to recursively visit children
671  *
672  * \sa Ast::visit_children for example.
673  */
674  virtual void visit_children(visitor::Visitor &v) override;
675 
676  /**
677  * \brief accept (or visit) the current AST node using provided visitor
678  *
679  * Instead of visiting children of AST node, like Ast::visit_children,
680  * accept allows to visit the current node itself using provided concrete
681  * visitor.
682  *
683  * \param v Concrete visitor that will be used to recursively visit node
684  *
685  * \sa Ast::accept for example.
686  */
687  virtual void accept(visitor::Visitor &v) override;
688 
689  /// \}
690 };
691 
692 /** @} */ // end of ast_class
693 
694 } // namespace ast
695 } // namespace nmodl
696 #endif // !NMODL_AST_IDENTIFIER_HPP
697 #ifndef NMODL_AST_NUMBER_HPP
698 #define NMODL_AST_NUMBER_HPP
699 
700 namespace nmodl {
701 namespace ast {
702 
703 /**
704  * @addtogroup ast_class
705  * @ingroup ast
706  * @{
707  */
708 
709 /**
710  * \brief Base class for all numbers
711  *
712  * Base class for all number types like ast::Integer, ast::Float and
713  * ast::Double.
714  *
715  */
716 class Number : public Expression {
717 
718 public:
719  /// \name Ctor & dtor
720  /// \{
721 
722  virtual ~Number() = default;
723 
724  /// \}
725 
726  /// \name Not implemented
727  /// \{
728 
729  virtual double to_double() {
730  throw std::runtime_error("to_double not implemented");
731  }
732 
733  /// \}
734 
735  /**
736  * \brief Check if the ast node is an instance of ast::Number
737  * \return true as object is of type ast::Number
738  */
739  bool is_number() const noexcept override { return true; }
740 
741  /**
742  * \brief Return a copy of the current node
743  *
744  * Recursively make a new copy/clone of the current node including
745  * all members and return a pointer to the node. This is used for
746  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
747  * ast.
748  *
749  * @return pointer to the clone/copy of the current node
750  */
751  virtual Number *clone() const override { return new Number(*this); }
752 
753  /// \name Getters
754  /// \{
755 
756  /**
757  * \brief Return type (ast::AstNodeType) of ast node
758  *
759  * Every node in the ast has a type defined in ast::AstNodeType and this
760  * function is used to retrieve the same.
761  *
762  * \return ast node type i.e. ast::AstNodeType::NUMBER
763  *
764  * \sa Ast::get_node_type_name
765  */
766  virtual AstNodeType get_node_type() const noexcept override {
767  return AstNodeType::NUMBER;
768  }
769 
770  /**
771  * \brief Return type (ast::AstNodeType) of ast node as std::string
772  *
773  * Every node in the ast has a type defined in ast::AstNodeType.
774  * This type name can be returned as a std::string for printing
775  * node to text/json form.
776  *
777  * \return name of the node type as a string i.e. "Number"
778  *
779  * \sa Ast::get_node_name
780  */
781  virtual std::string get_node_type_name() const noexcept override {
782  return "Number";
783  }
784 
785  /**
786  * \brief Get std::shared_ptr from `this` pointer of the current ast node
787  */
788  virtual std::shared_ptr<Ast> get_shared_ptr() override {
789  return std::static_pointer_cast<Number>(shared_from_this());
790  }
791 
792  /**
793  * \brief Get std::shared_ptr from `this` pointer of the current ast node
794  */
795  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
796  return std::static_pointer_cast<const Number>(shared_from_this());
797  }
798 
799  /// \}
800 
801  /// \name Visitor
802  /// \{
803 
804  /**
805  * \brief visit children i.e. member variables of current node using provided
806  * visitor
807  *
808  * Different nodes in the AST have different members (i.e. children). This
809  * method recursively visits children using provided visitor.
810  *
811  * \param v Concrete visitor that will be used to recursively visit children
812  *
813  * \sa Ast::visit_children for example.
814  */
815  virtual void visit_children(visitor::Visitor &v) override;
816 
817  /**
818  * \brief accept (or visit) the current AST node using provided visitor
819  *
820  * Instead of visiting children of AST node, like Ast::visit_children,
821  * accept allows to visit the current node itself using provided concrete
822  * visitor.
823  *
824  * \param v Concrete visitor that will be used to recursively visit node
825  *
826  * \sa Ast::accept for example.
827  */
828  virtual void accept(visitor::Visitor &v) override;
829 
830  /// \}
831 };
832 
833 /** @} */ // end of ast_class
834 
835 } // namespace ast
836 } // namespace nmodl
837 #endif // !NMODL_AST_NUMBER_HPP
838 #ifndef NMODL_AST_STRING_HPP
839 #define NMODL_AST_STRING_HPP
840 
841 namespace nmodl {
842 namespace ast {
843 
844 /**
845  * @addtogroup ast_class
846  * @ingroup ast
847  * @{
848  */
849 
850 /**
851  * \brief Represents a string
852  *
853  * All statements encapsulating text block are stored in the AST as ast::String.
854  * For example, nodes like ast::LineComment and ast::Verbatim block use
855  * ast::String::value to store the underlying text:
856  *
857  * \code{.mod}
858  * COMMENT
859  * This text is stored as String
860  * ENDCOMMENT
861  *
862  * VERBATIM
863  * int *x;
864  * *x = ...
865  * ENDVERBATIM
866  * \endcode
867  *
868  */
869 class String : public Expression {
870 private:
871  /// Value of string
872  std::string value;
873  /// token with location information
874  std::shared_ptr<ModToken> token;
875 
876 public:
877  /// \name Ctor & dtor
878  /// \{
879 
880  explicit String(const std::string &value);
881  String(const String &obj);
882 
883  String() = default;
884 
885  virtual ~String() = default;
886 
887  /// \}
888 
889  /**
890  * \brief Check if the ast node is an instance of ast::String
891  * \return true as object is of type ast::String
892  */
893  bool is_string() const noexcept override { return true; }
894 
895  /**
896  * \brief Return a copy of the current node
897  *
898  * Recursively make a new copy/clone of the current node including
899  * all members and return a pointer to the node. This is used for
900  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
901  * ast.
902  *
903  * @return pointer to the clone/copy of the current node
904  */
905  String *clone() const override { return new String(*this); }
906 
907  /// \name Getters
908  /// \{
909 
910  /**
911  * \brief Return type (ast::AstNodeType) of ast node
912  *
913  * Every node in the ast has a type defined in ast::AstNodeType and this
914  * function is used to retrieve the same.
915  *
916  * \return ast node type i.e. ast::AstNodeType::STRING
917  *
918  * \sa Ast::get_node_type_name
919  */
920  AstNodeType get_node_type() const noexcept override {
921  return AstNodeType::STRING;
922  }
923 
924  /**
925  * \brief Return type (ast::AstNodeType) of ast node as std::string
926  *
927  * Every node in the ast has a type defined in ast::AstNodeType.
928  * This type name can be returned as a std::string for printing
929  * node to text/json form.
930  *
931  * \return name of the node type as a string i.e. "String"
932  *
933  * \sa Ast::get_node_name
934  */
935  std::string get_node_type_name() const noexcept override { return "String"; }
936 
937  /**
938  * \brief Get std::shared_ptr from `this` pointer of the current ast node
939  */
940  std::shared_ptr<Ast> get_shared_ptr() override {
941  return std::static_pointer_cast<String>(shared_from_this());
942  }
943 
944  /**
945  * \brief Get std::shared_ptr from `this` pointer of the current ast node
946  */
947  std::shared_ptr<const Ast> get_shared_ptr() const override {
948  return std::static_pointer_cast<const String>(shared_from_this());
949  }
950 
951  /**
952  * \brief Return associated token for the current ast node
953  *
954  * Not all ast nodes have token information. For example,
955  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
956  * solution of ODEs. In this case, we return nullptr to store in the
957  * nmodl::symtab::SymbolTable.
958  *
959  * \return pointer to token if exist otherwise nullptr
960  */
961  const ModToken *get_token() const noexcept override { return token.get(); }
962 
963  /**
964  * \brief Getter for member variable \ref String.value
965  */
966  const std::string &get_value() const noexcept { return value; }
967 
968  /// \}
969 
970  /// \name Setters
971  /// \{
972 
973  /**
974  * \brief Set token for the current ast node
975  */
976  void set_token(const ModToken &tok) {
977  token = std::make_shared<ModToken>(tok);
978  }
979 
980  /**
981  * \brief Set new value to the current ast node
982  * \sa String::eval
983  */
984  void set(std::string _value) { value = _value; }
985 
986  /**
987  * \brief Setter for member variable \ref String.value
988  */
989  void set_value(std::string value);
990 
991  /// \}
992 
993  /// \name Visitor
994  /// \{
995 
996  /**
997  * \brief visit children i.e. member variables of current node using provided
998  * visitor
999  *
1000  * Different nodes in the AST have different members (i.e. children). This
1001  * method recursively visits children using provided visitor.
1002  *
1003  * \param v Concrete visitor that will be used to recursively visit children
1004  *
1005  * \sa Ast::visit_children for example.
1006  */
1007  void visit_children(visitor::Visitor &v) override;
1008 
1009  /**
1010  * \brief accept (or visit) the current AST node using provided visitor
1011  *
1012  * Instead of visiting children of AST node, like Ast::visit_children,
1013  * accept allows to visit the current node itself using provided concrete
1014  * visitor.
1015  *
1016  * \param v Concrete visitor that will be used to recursively visit node
1017  *
1018  * \sa Ast::accept for example.
1019  */
1020  void accept(visitor::Visitor &v) override;
1021 
1022  /// \}
1023 
1024  /**
1025  * \brief Return value of the ast node
1026  *
1027  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1028  * to their literal values. This method is used to access underlying
1029  * literal value.
1030  *
1031  * \sa String::set
1032  */
1033  std::string eval() const { return value; }
1034 
1035 private:
1036  /**
1037  * \brief Set this object as parent for all the children
1038  *
1039  * This should be called in every object (with children) constructor
1040  * to set parents. Since it is called only in the constructors it
1041  * should not be virtual to avoid ambiguities (issue #295).
1042  */
1043  void set_parent_in_children();
1044 };
1045 
1046 /** @} */ // end of ast_class
1047 
1048 } // namespace ast
1049 } // namespace nmodl
1050 #endif // !NMODL_AST_STRING_HPP
1051 #ifndef NMODL_AST_INTEGER_HPP
1052 #define NMODL_AST_INTEGER_HPP
1053 
1054 namespace nmodl {
1055 namespace ast {
1056 
1057 /**
1058  * @addtogroup ast_class
1059  * @ingroup ast
1060  * @{
1061  */
1062 
1063 /**
1064  * \brief Represents an integer variable
1065  *
1066  * Non floating value in the mod file is parsed as an integer. For example,
1067  * in the below code, integer literals like `0` and `11` are stored as
1068  * ast::Integer in the AST :
1069  *
1070  * \code{.mod}
1071  * FROM i=0 TO N {
1072  * tau = X[i] + 11
1073  * }
1074  * \endcode
1075  *
1076  * \sa ast::Float ast::Double
1077  *
1078  */
1079 class Integer : public Number {
1080 private:
1081  /// Value of integer
1082  int value;
1083  /// if integer is a macro then it's name
1084  std::shared_ptr<Name> macro;
1085  /// token with location information
1086  std::shared_ptr<ModToken> token;
1087 
1088 public:
1089  /// \name Ctor & dtor
1090  /// \{
1091 
1092  explicit Integer(int value, Name *macro);
1093  explicit Integer(int value, const std::shared_ptr<Name> &macro);
1094  Integer(const Integer &obj);
1095 
1096  Integer() = default;
1097 
1098  virtual ~Integer() = default;
1099 
1100  /// \}
1101 
1102  /**
1103  * \brief Check if the ast node is an instance of ast::Integer
1104  * \return true as object is of type ast::Integer
1105  */
1106  bool is_integer() const noexcept override { return true; }
1107 
1108  /**
1109  * \brief Return a copy of the current node
1110  *
1111  * Recursively make a new copy/clone of the current node including
1112  * all members and return a pointer to the node. This is used for
1113  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1114  * ast.
1115  *
1116  * @return pointer to the clone/copy of the current node
1117  */
1118  Integer *clone() const override { return new Integer(*this); }
1119 
1120  /// \name Getters
1121  /// \{
1122 
1123  /**
1124  * \brief Return type (ast::AstNodeType) of ast node
1125  *
1126  * Every node in the ast has a type defined in ast::AstNodeType and this
1127  * function is used to retrieve the same.
1128  *
1129  * \return ast node type i.e. ast::AstNodeType::INTEGER
1130  *
1131  * \sa Ast::get_node_type_name
1132  */
1133  AstNodeType get_node_type() const noexcept override {
1134  return AstNodeType::INTEGER;
1135  }
1136 
1137  /**
1138  * \brief Return type (ast::AstNodeType) of ast node as std::string
1139  *
1140  * Every node in the ast has a type defined in ast::AstNodeType.
1141  * This type name can be returned as a std::string for printing
1142  * node to text/json form.
1143  *
1144  * \return name of the node type as a string i.e. "Integer"
1145  *
1146  * \sa Ast::get_node_name
1147  */
1148  std::string get_node_type_name() const noexcept override { return "Integer"; }
1149 
1150  /**
1151  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1152  */
1153  std::shared_ptr<Ast> get_shared_ptr() override {
1154  return std::static_pointer_cast<Integer>(shared_from_this());
1155  }
1156 
1157  /**
1158  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1159  */
1160  std::shared_ptr<const Ast> get_shared_ptr() const override {
1161  return std::static_pointer_cast<const Integer>(shared_from_this());
1162  }
1163 
1164  /**
1165  * \brief Return associated token for the current ast node
1166  *
1167  * Not all ast nodes have token information. For example,
1168  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
1169  * solution of ODEs. In this case, we return nullptr to store in the
1170  * nmodl::symtab::SymbolTable.
1171  *
1172  * \return pointer to token if exist otherwise nullptr
1173  */
1174  const ModToken *get_token() const noexcept override { return token.get(); }
1175 
1176  /**
1177  * \brief Getter for member variable \ref Integer.value
1178  */
1179  int get_value() const noexcept { return value; }
1180 
1181  /**
1182  * \brief Getter for member variable \ref Integer.macro
1183  */
1184  const std::shared_ptr<Name> &get_macro() const noexcept { return macro; }
1185 
1186  /// \}
1187 
1188  /// \name Setters
1189  /// \{
1190 
1191  /**
1192  * \brief Set token for the current ast node
1193  */
1194  void set_token(const ModToken &tok) {
1195  token = std::make_shared<ModToken>(tok);
1196  }
1197 
1198  /**
1199  * \brief Set new value to the current ast node
1200  * \sa Integer::eval
1201  */
1202  void set(int _value) { value = _value; }
1203 
1204  /**
1205  * \brief Setter for member variable \ref Integer.value
1206  */
1207  void set_value(int value);
1208 
1209  /**
1210  * \brief Setter for member variable \ref Integer.macro (rvalue reference)
1211  */
1212  void set_macro(std::shared_ptr<Name> &&macro);
1213 
1214  /**
1215  * \brief Setter for member variable \ref Integer.macro
1216  */
1217  void set_macro(const std::shared_ptr<Name> &macro);
1218 
1219  /// \}
1220 
1221  /// \name Visitor
1222  /// \{
1223 
1224  /**
1225  * \brief visit children i.e. member variables of current node using provided
1226  * visitor
1227  *
1228  * Different nodes in the AST have different members (i.e. children). This
1229  * method recursively visits children using provided visitor.
1230  *
1231  * \param v Concrete visitor that will be used to recursively visit children
1232  *
1233  * \sa Ast::visit_children for example.
1234  */
1235  void visit_children(visitor::Visitor &v) override;
1236 
1237  /**
1238  * \brief accept (or visit) the current AST node using provided visitor
1239  *
1240  * Instead of visiting children of AST node, like Ast::visit_children,
1241  * accept allows to visit the current node itself using provided concrete
1242  * visitor.
1243  *
1244  * \param v Concrete visitor that will be used to recursively visit node
1245  *
1246  * \sa Ast::accept for example.
1247  */
1248  void accept(visitor::Visitor &v) override;
1249 
1250  /// \}
1251 
1252  /**
1253  * \brief Negate the value of current ast node
1254  *
1255  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
1256  * `-` is encountered, the corresponding value of ast node needs to be
1257  * multiplied by `-1` for ast::Number node types.
1258  */
1259  void negate() override { value = -value; }
1260 
1261  /**
1262  * \brief Return value of the current ast node as double
1263  */
1264  double to_double() override { return value; }
1265 
1266  /**
1267  * \brief Return value of the ast node
1268  *
1269  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1270  * to their literal values. This method is used to access underlying
1271  * literal value.
1272  *
1273  * \sa Integer::set
1274  */
1275  int eval() const { return value; }
1276 
1277 private:
1278  /**
1279  * \brief Set this object as parent for all the children
1280  *
1281  * This should be called in every object (with children) constructor
1282  * to set parents. Since it is called only in the constructors it
1283  * should not be virtual to avoid ambiguities (issue #295).
1284  */
1285  void set_parent_in_children();
1286 };
1287 
1288 /** @} */ // end of ast_class
1289 
1290 } // namespace ast
1291 } // namespace nmodl
1292 #endif // !NMODL_AST_INTEGER_HPP
1293 #ifndef NMODL_AST_FLOAT_HPP
1294 #define NMODL_AST_FLOAT_HPP
1295 
1296 namespace nmodl {
1297 namespace ast {
1298 
1299 /**
1300  * @addtogroup ast_class
1301  * @ingroup ast
1302  * @{
1303  */
1304 
1305 /**
1306  * \brief Represents a float variable
1307  *
1308  * Single precision float value in the mod file can be represented by
1309  * ast::Float.
1310  *
1311  * \note Currently every float variable in the NMODL is stored as ast::Double
1312  * and hence this type is note used. This will be changed soon for variables
1313  * like ast::ParamAssign.
1314  *
1315  * \sa ast::Integer ast::Double
1316  *
1317  */
1318 class Float : public Number {
1319 private:
1320  /// Value of float
1321  float value;
1322  /// token with location information
1323  std::shared_ptr<ModToken> token;
1324 
1325 public:
1326  /// \name Ctor & dtor
1327  /// \{
1328 
1329  explicit Float(float value);
1330  Float(const Float &obj);
1331 
1332  virtual ~Float() = default;
1333 
1334  /// \}
1335 
1336  /**
1337  * \brief Check if the ast node is an instance of ast::Float
1338  * \return true as object is of type ast::Float
1339  */
1340  bool is_float() const noexcept override { return true; }
1341 
1342  /**
1343  * \brief Return a copy of the current node
1344  *
1345  * Recursively make a new copy/clone of the current node including
1346  * all members and return a pointer to the node. This is used for
1347  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1348  * ast.
1349  *
1350  * @return pointer to the clone/copy of the current node
1351  */
1352  Float *clone() const override { return new Float(*this); }
1353 
1354  /// \name Getters
1355  /// \{
1356 
1357  /**
1358  * \brief Return type (ast::AstNodeType) of ast node
1359  *
1360  * Every node in the ast has a type defined in ast::AstNodeType and this
1361  * function is used to retrieve the same.
1362  *
1363  * \return ast node type i.e. ast::AstNodeType::FLOAT
1364  *
1365  * \sa Ast::get_node_type_name
1366  */
1367  AstNodeType get_node_type() const noexcept override {
1368  return AstNodeType::FLOAT;
1369  }
1370 
1371  /**
1372  * \brief Return type (ast::AstNodeType) of ast node as std::string
1373  *
1374  * Every node in the ast has a type defined in ast::AstNodeType.
1375  * This type name can be returned as a std::string for printing
1376  * node to text/json form.
1377  *
1378  * \return name of the node type as a string i.e. "Float"
1379  *
1380  * \sa Ast::get_node_name
1381  */
1382  std::string get_node_type_name() const noexcept override { return "Float"; }
1383 
1384  /**
1385  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1386  */
1387  std::shared_ptr<Ast> get_shared_ptr() override {
1388  return std::static_pointer_cast<Float>(shared_from_this());
1389  }
1390 
1391  /**
1392  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1393  */
1394  std::shared_ptr<const Ast> get_shared_ptr() const override {
1395  return std::static_pointer_cast<const Float>(shared_from_this());
1396  }
1397 
1398  /**
1399  * \brief Return associated token for the current ast node
1400  *
1401  * Not all ast nodes have token information. For example,
1402  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
1403  * solution of ODEs. In this case, we return nullptr to store in the
1404  * nmodl::symtab::SymbolTable.
1405  *
1406  * \return pointer to token if exist otherwise nullptr
1407  */
1408  const ModToken *get_token() const noexcept override { return token.get(); }
1409 
1410  /**
1411  * \brief Getter for member variable \ref Float.value
1412  */
1413  float get_value() const noexcept { return value; }
1414 
1415  /// \}
1416 
1417  /// \name Setters
1418  /// \{
1419 
1420  /**
1421  * \brief Set token for the current ast node
1422  */
1423  void set_token(const ModToken &tok) {
1424  token = std::make_shared<ModToken>(tok);
1425  }
1426 
1427  /**
1428  * \brief Set new value to the current ast node
1429  * \sa Float::eval
1430  */
1431  void set(float _value) { value = _value; }
1432 
1433  /**
1434  * \brief Setter for member variable \ref Float.value
1435  */
1436  void set_value(float value);
1437 
1438  /// \}
1439 
1440  /// \name Visitor
1441  /// \{
1442 
1443  /**
1444  * \brief visit children i.e. member variables of current node using provided
1445  * visitor
1446  *
1447  * Different nodes in the AST have different members (i.e. children). This
1448  * method recursively visits children using provided visitor.
1449  *
1450  * \param v Concrete visitor that will be used to recursively visit children
1451  *
1452  * \sa Ast::visit_children for example.
1453  */
1454  void visit_children(visitor::Visitor &v) override;
1455 
1456  /**
1457  * \brief accept (or visit) the current AST node using provided visitor
1458  *
1459  * Instead of visiting children of AST node, like Ast::visit_children,
1460  * accept allows to visit the current node itself using provided concrete
1461  * visitor.
1462  *
1463  * \param v Concrete visitor that will be used to recursively visit node
1464  *
1465  * \sa Ast::accept for example.
1466  */
1467  void accept(visitor::Visitor &v) override;
1468 
1469  /// \}
1470 
1471  /**
1472  * \brief Negate the value of current ast node
1473  *
1474  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
1475  * `-` is encountered, the corresponding value of ast node needs to be
1476  * multiplied by `-1` for ast::Number node types.
1477  */
1478  void negate() override { value = -value; }
1479 
1480  /**
1481  * \brief Return value of the current ast node as double
1482  */
1483  double to_double() override { return value; }
1484 
1485  /**
1486  * \brief Return value of the ast node
1487  *
1488  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1489  * to their literal values. This method is used to access underlying
1490  * literal value.
1491  *
1492  * \sa Float::set
1493  */
1494  float eval() const { return value; }
1495 
1496 private:
1497  /**
1498  * \brief Set this object as parent for all the children
1499  *
1500  * This should be called in every object (with children) constructor
1501  * to set parents. Since it is called only in the constructors it
1502  * should not be virtual to avoid ambiguities (issue #295).
1503  */
1504  void set_parent_in_children();
1505 };
1506 
1507 /** @} */ // end of ast_class
1508 
1509 } // namespace ast
1510 } // namespace nmodl
1511 #endif // !NMODL_AST_FLOAT_HPP
1512 #ifndef NMODL_AST_DOUBLE_HPP
1513 #define NMODL_AST_DOUBLE_HPP
1514 
1515 namespace nmodl {
1516 namespace ast {
1517 
1518 /**
1519  * @addtogroup ast_class
1520  * @ingroup ast
1521  * @{
1522  */
1523 
1524 /**
1525  * \brief Represents a double variable
1526  *
1527  * %Double precision float value in the mod file is represented by ast::Double.
1528  * For example, float literals like `0.1` in the mod file are parsed as double
1529  * and stored using ast::Double::value :
1530  *
1531  * \code{.mod}
1532  * PROCEDURE foo() {
1533  * LOCAL x
1534  * x = 0.1 + tau
1535  * }
1536  * \endcode
1537  *
1538  * Note that the variables are not classified ast integer or float in the AST.
1539  * The decision about variable types is done by code generation backends.
1540  *
1541  * \sa ast::Integer ast::Float
1542  *
1543  */
1544 class Double : public Number {
1545 private:
1546  /// Value of double
1547  double value;
1548  /// token with location information
1549  std::shared_ptr<ModToken> token;
1550 
1551 public:
1552  /// \name Ctor & dtor
1553  /// \{
1554 
1555  explicit Double(double value);
1556  Double(const Double &obj);
1557 
1558  Double() = default;
1559 
1560  virtual ~Double() = default;
1561 
1562  /// \}
1563 
1564  /**
1565  * \brief Check if the ast node is an instance of ast::Double
1566  * \return true as object is of type ast::Double
1567  */
1568  bool is_double() const noexcept override { return true; }
1569 
1570  /**
1571  * \brief Return a copy of the current node
1572  *
1573  * Recursively make a new copy/clone of the current node including
1574  * all members and return a pointer to the node. This is used for
1575  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1576  * ast.
1577  *
1578  * @return pointer to the clone/copy of the current node
1579  */
1580  Double *clone() const override { return new Double(*this); }
1581 
1582  /// \name Getters
1583  /// \{
1584 
1585  /**
1586  * \brief Return type (ast::AstNodeType) of ast node
1587  *
1588  * Every node in the ast has a type defined in ast::AstNodeType and this
1589  * function is used to retrieve the same.
1590  *
1591  * \return ast node type i.e. ast::AstNodeType::DOUBLE
1592  *
1593  * \sa Ast::get_node_type_name
1594  */
1595  AstNodeType get_node_type() const noexcept override {
1596  return AstNodeType::DOUBLE;
1597  }
1598 
1599  /**
1600  * \brief Return type (ast::AstNodeType) of ast node as std::string
1601  *
1602  * Every node in the ast has a type defined in ast::AstNodeType.
1603  * This type name can be returned as a std::string for printing
1604  * node to text/json form.
1605  *
1606  * \return name of the node type as a string i.e. "Double"
1607  *
1608  * \sa Ast::get_node_name
1609  */
1610  std::string get_node_type_name() const noexcept override { return "Double"; }
1611 
1612  /**
1613  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1614  */
1615  std::shared_ptr<Ast> get_shared_ptr() override {
1616  return std::static_pointer_cast<Double>(shared_from_this());
1617  }
1618 
1619  /**
1620  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1621  */
1622  std::shared_ptr<const Ast> get_shared_ptr() const override {
1623  return std::static_pointer_cast<const Double>(shared_from_this());
1624  }
1625 
1626  /**
1627  * \brief Return associated token for the current ast node
1628  *
1629  * Not all ast nodes have token information. For example,
1630  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
1631  * solution of ODEs. In this case, we return nullptr to store in the
1632  * nmodl::symtab::SymbolTable.
1633  *
1634  * \return pointer to token if exist otherwise nullptr
1635  */
1636  const ModToken *get_token() const noexcept override { return token.get(); }
1637 
1638  /**
1639  * \brief Getter for member variable \ref Double.value
1640  */
1641  double get_value() const noexcept { return value; }
1642 
1643  /// \}
1644 
1645  /// \name Setters
1646  /// \{
1647 
1648  /**
1649  * \brief Set token for the current ast node
1650  */
1651  void set_token(const ModToken &tok) {
1652  token = std::make_shared<ModToken>(tok);
1653  }
1654 
1655  /**
1656  * \brief Set new value to the current ast node
1657  * \sa Double::eval
1658  */
1659  void set(double _value) { value = _value; }
1660 
1661  /**
1662  * \brief Setter for member variable \ref Double.value
1663  */
1664  void set_value(double value);
1665 
1666  /// \}
1667 
1668  /// \name Visitor
1669  /// \{
1670 
1671  /**
1672  * \brief visit children i.e. member variables of current node using provided
1673  * visitor
1674  *
1675  * Different nodes in the AST have different members (i.e. children). This
1676  * method recursively visits children using provided visitor.
1677  *
1678  * \param v Concrete visitor that will be used to recursively visit children
1679  *
1680  * \sa Ast::visit_children for example.
1681  */
1682  void visit_children(visitor::Visitor &v) override;
1683 
1684  /**
1685  * \brief accept (or visit) the current AST node using provided visitor
1686  *
1687  * Instead of visiting children of AST node, like Ast::visit_children,
1688  * accept allows to visit the current node itself using provided concrete
1689  * visitor.
1690  *
1691  * \param v Concrete visitor that will be used to recursively visit node
1692  *
1693  * \sa Ast::accept for example.
1694  */
1695  void accept(visitor::Visitor &v) override;
1696 
1697  /// \}
1698 
1699  /**
1700  * \brief Negate the value of current ast node
1701  *
1702  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
1703  * `-` is encountered, the corresponding value of ast node needs to be
1704  * multiplied by `-1` for ast::Number node types.
1705  */
1706  void negate() override { value = -value; }
1707 
1708  /**
1709  * \brief Return value of the current ast node as double
1710  */
1711  double to_double() override { return value; }
1712 
1713  /**
1714  * \brief Return value of the ast node
1715  *
1716  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1717  * to their literal values. This method is used to access underlying
1718  * literal value.
1719  *
1720  * \sa Double::set
1721  */
1722  double eval() const { return value; }
1723 
1724 private:
1725  /**
1726  * \brief Set this object as parent for all the children
1727  *
1728  * This should be called in every object (with children) constructor
1729  * to set parents. Since it is called only in the constructors it
1730  * should not be virtual to avoid ambiguities (issue #295).
1731  */
1732  void set_parent_in_children();
1733 };
1734 
1735 /** @} */ // end of ast_class
1736 
1737 } // namespace ast
1738 } // namespace nmodl
1739 #endif // !NMODL_AST_DOUBLE_HPP
1740 #ifndef NMODL_AST_BOOLEAN_HPP
1741 #define NMODL_AST_BOOLEAN_HPP
1742 
1743 namespace nmodl {
1744 namespace ast {
1745 
1746 /**
1747  * @addtogroup ast_class
1748  * @ingroup ast
1749  * @{
1750  */
1751 
1752 /**
1753  * \brief Represents a boolean variable
1754  *
1755  * %Boolean values in the mod file can be represented by ast::Boolean.
1756  *
1757  * \note Currently this type is used as only flag in some of the AST nodes.
1758  * Similar to ast::Float, this type was introduced for data type specific code
1759  * generation support in the future.
1760  *
1761  */
1762 class Boolean : public Number {
1763 private:
1764  /// Value of boolean
1765  int value;
1766  /// token with location information
1767  std::shared_ptr<ModToken> token;
1768 
1769 public:
1770  /// \name Ctor & dtor
1771  /// \{
1772 
1773  explicit Boolean(int value);
1774  Boolean(const Boolean &obj);
1775 
1776  virtual ~Boolean() = default;
1777 
1778  /// \}
1779 
1780  /**
1781  * \brief Check if the ast node is an instance of ast::Boolean
1782  * \return true as object is of type ast::Boolean
1783  */
1784  bool is_boolean() const noexcept override { return true; }
1785 
1786  /**
1787  * \brief Return a copy of the current node
1788  *
1789  * Recursively make a new copy/clone of the current node including
1790  * all members and return a pointer to the node. This is used for
1791  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1792  * ast.
1793  *
1794  * @return pointer to the clone/copy of the current node
1795  */
1796  Boolean *clone() const override { return new Boolean(*this); }
1797 
1798  /// \name Getters
1799  /// \{
1800 
1801  /**
1802  * \brief Return type (ast::AstNodeType) of ast node
1803  *
1804  * Every node in the ast has a type defined in ast::AstNodeType and this
1805  * function is used to retrieve the same.
1806  *
1807  * \return ast node type i.e. ast::AstNodeType::BOOLEAN
1808  *
1809  * \sa Ast::get_node_type_name
1810  */
1811  AstNodeType get_node_type() const noexcept override {
1812  return AstNodeType::BOOLEAN;
1813  }
1814 
1815  /**
1816  * \brief Return type (ast::AstNodeType) of ast node as std::string
1817  *
1818  * Every node in the ast has a type defined in ast::AstNodeType.
1819  * This type name can be returned as a std::string for printing
1820  * node to text/json form.
1821  *
1822  * \return name of the node type as a string i.e. "Boolean"
1823  *
1824  * \sa Ast::get_node_name
1825  */
1826  std::string get_node_type_name() const noexcept override { return "Boolean"; }
1827 
1828  /**
1829  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1830  */
1831  std::shared_ptr<Ast> get_shared_ptr() override {
1832  return std::static_pointer_cast<Boolean>(shared_from_this());
1833  }
1834 
1835  /**
1836  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1837  */
1838  std::shared_ptr<const Ast> get_shared_ptr() const override {
1839  return std::static_pointer_cast<const Boolean>(shared_from_this());
1840  }
1841 
1842  /**
1843  * \brief Return associated token for the current ast node
1844  *
1845  * Not all ast nodes have token information. For example,
1846  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
1847  * solution of ODEs. In this case, we return nullptr to store in the
1848  * nmodl::symtab::SymbolTable.
1849  *
1850  * \return pointer to token if exist otherwise nullptr
1851  */
1852  const ModToken *get_token() const noexcept override { return token.get(); }
1853 
1854  /**
1855  * \brief Getter for member variable \ref Boolean.value
1856  */
1857  int get_value() const noexcept { return value; }
1858 
1859  /// \}
1860 
1861  /// \name Setters
1862  /// \{
1863 
1864  /**
1865  * \brief Set token for the current ast node
1866  */
1867  void set_token(const ModToken &tok) {
1868  token = std::make_shared<ModToken>(tok);
1869  }
1870 
1871  /**
1872  * \brief Set new value to the current ast node
1873  * \sa Boolean::eval
1874  */
1875  void set(bool _value) { value = _value; }
1876 
1877  /**
1878  * \brief Setter for member variable \ref Boolean.value
1879  */
1880  void set_value(int value);
1881 
1882  /// \}
1883 
1884  /// \name Visitor
1885  /// \{
1886 
1887  /**
1888  * \brief visit children i.e. member variables of current node using provided
1889  * visitor
1890  *
1891  * Different nodes in the AST have different members (i.e. children). This
1892  * method recursively visits children using provided visitor.
1893  *
1894  * \param v Concrete visitor that will be used to recursively visit children
1895  *
1896  * \sa Ast::visit_children for example.
1897  */
1898  void visit_children(visitor::Visitor &v) override;
1899 
1900  /**
1901  * \brief accept (or visit) the current AST node using provided visitor
1902  *
1903  * Instead of visiting children of AST node, like Ast::visit_children,
1904  * accept allows to visit the current node itself using provided concrete
1905  * visitor.
1906  *
1907  * \param v Concrete visitor that will be used to recursively visit node
1908  *
1909  * \sa Ast::accept for example.
1910  */
1911  void accept(visitor::Visitor &v) override;
1912 
1913  /// \}
1914 
1915  /**
1916  * \brief Negate the value of current ast node
1917  *
1918  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
1919  * `-` is encountered, the corresponding value of ast node needs to be
1920  * multiplied by `-1` for ast::Number node types.
1921  */
1922  void negate() override { value = !value; }
1923 
1924  /**
1925  * \brief Return value of the current ast node as double
1926  */
1927  double to_double() override { return value; }
1928 
1929  /**
1930  * \brief Return value of the ast node
1931  *
1932  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1933  * to their literal values. This method is used to access underlying
1934  * literal value.
1935  *
1936  * \sa Boolean::set
1937  */
1938  bool eval() const { return value; }
1939 
1940 private:
1941  /**
1942  * \brief Set this object as parent for all the children
1943  *
1944  * This should be called in every object (with children) constructor
1945  * to set parents. Since it is called only in the constructors it
1946  * should not be virtual to avoid ambiguities (issue #295).
1947  */
1948  void set_parent_in_children();
1949 };
1950 
1951 /** @} */ // end of ast_class
1952 
1953 } // namespace ast
1954 } // namespace nmodl
1955 #endif // !NMODL_AST_BOOLEAN_HPP
1956 #ifndef NMODL_AST_NAME_HPP
1957 #define NMODL_AST_NAME_HPP
1958 
1959 namespace nmodl {
1960 namespace ast {
1961 
1962 /**
1963  * @addtogroup ast_class
1964  * @ingroup ast
1965  * @{
1966  */
1967 
1968 /**
1969  * \brief Represents a name
1970  *
1971  * Whenever lexer encounters string variable, it returns a ast::Name
1972  * type. So, along with ast::Integer, ast::Double ast::String and
1973  * ast::PrimeName, ast::Name is one of the fundamental type in the AST. Many
1974  * other variable types (e.g. ast::GlobalVar, ast::RangeVar) have underlying
1975  * value stored as ast::Name.
1976  *
1977  * \note This node should be able to use std::string as value type instead of
1978  * ast::String
1979  *
1980  */
1981 class Name : public Identifier {
1982 private:
1983  /// Value of name
1984  std::shared_ptr<String> value;
1985  /// token with location information
1986  std::shared_ptr<ModToken> token;
1987 
1988 public:
1989  /// \name Ctor & dtor
1990  /// \{
1991 
1992  explicit Name(String *value);
1993  explicit Name(const std::shared_ptr<String> &value);
1994  Name(const Name &obj);
1995 
1996  Name() = default;
1997 
1998  virtual ~Name() = default;
1999 
2000  /// \}
2001 
2002  /**
2003  * \brief Check if the ast node is an instance of ast::Name
2004  * \return true as object is of type ast::Name
2005  */
2006  bool is_name() const noexcept override { return true; }
2007 
2008  /**
2009  * \brief Return a copy of the current node
2010  *
2011  * Recursively make a new copy/clone of the current node including
2012  * all members and return a pointer to the node. This is used for
2013  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2014  * ast.
2015  *
2016  * @return pointer to the clone/copy of the current node
2017  */
2018  Name *clone() const override { return new Name(*this); }
2019 
2020  /// \name Getters
2021  /// \{
2022 
2023  /**
2024  * \brief Return type (ast::AstNodeType) of ast node
2025  *
2026  * Every node in the ast has a type defined in ast::AstNodeType and this
2027  * function is used to retrieve the same.
2028  *
2029  * \return ast node type i.e. ast::AstNodeType::NAME
2030  *
2031  * \sa Ast::get_node_type_name
2032  */
2033  AstNodeType get_node_type() const noexcept override {
2034  return AstNodeType::NAME;
2035  }
2036 
2037  /**
2038  * \brief Return type (ast::AstNodeType) of ast node as std::string
2039  *
2040  * Every node in the ast has a type defined in ast::AstNodeType.
2041  * This type name can be returned as a std::string for printing
2042  * node to text/json form.
2043  *
2044  * \return name of the node type as a string i.e. "Name"
2045  *
2046  * \sa Ast::get_node_name
2047  */
2048  std::string get_node_type_name() const noexcept override { return "Name"; }
2049 
2050  /**
2051  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2052  */
2053  std::shared_ptr<Ast> get_shared_ptr() override {
2054  return std::static_pointer_cast<Name>(shared_from_this());
2055  }
2056 
2057  /**
2058  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2059  */
2060  std::shared_ptr<const Ast> get_shared_ptr() const override {
2061  return std::static_pointer_cast<const Name>(shared_from_this());
2062  }
2063 
2064  /**
2065  * \brief Return associated token for the current ast node
2066  *
2067  * Not all ast nodes have token information. For example,
2068  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
2069  * solution of ODEs. In this case, we return nullptr to store in the
2070  * nmodl::symtab::SymbolTable.
2071  *
2072  * \return pointer to token if exist otherwise nullptr
2073  */
2074  const ModToken *get_token() const noexcept override { return token.get(); }
2075 
2076  /**
2077  * \brief Return name of the node
2078  *
2079  * Some ast nodes have a member marked designated as node name. For example,
2080  * in case of this ast::String has value designated as a
2081  * node name.
2082  *
2083  * @return name of the node as std::string
2084  *
2085  * \sa Ast::get_node_type_name
2086  */
2087  std::string get_node_name() const override;
2088 
2089  /**
2090  * \brief Getter for member variable \ref Name.value
2091  */
2092  const std::shared_ptr<String> &get_value() const noexcept { return value; }
2093 
2094  /// \}
2095 
2096  /// \name Setters
2097  /// \{
2098 
2099  /**
2100  * \brief Set name for the current ast node
2101  *
2102  * Some ast nodes have a member marked designated as node name (e.g. nodes
2103  * derived from ast::Identifier). This method is used to set new name for
2104  * those nodes. This useful for passes like nmodl::visitor::RenameVisitor.
2105  *
2106  * \sa Ast::get_node_type_name Ast::get_node_name
2107  */
2108  void set_name(const std::string &name) override;
2109 
2110  /**
2111  * \brief Set token for the current ast node
2112  */
2113  void set_token(const ModToken &tok) {
2114  token = std::make_shared<ModToken>(tok);
2115  }
2116 
2117  /**
2118  * \brief Setter for member variable \ref Name.value (rvalue reference)
2119  */
2120  void set_value(std::shared_ptr<String> &&value);
2121 
2122  /**
2123  * \brief Setter for member variable \ref Name.value
2124  */
2125  void set_value(const std::shared_ptr<String> &value);
2126 
2127  /// \}
2128 
2129  /// \name Visitor
2130  /// \{
2131 
2132  /**
2133  * \brief visit children i.e. member variables of current node using provided
2134  * visitor
2135  *
2136  * Different nodes in the AST have different members (i.e. children). This
2137  * method recursively visits children using provided visitor.
2138  *
2139  * \param v Concrete visitor that will be used to recursively visit children
2140  *
2141  * \sa Ast::visit_children for example.
2142  */
2143  void visit_children(visitor::Visitor &v) override;
2144 
2145  /**
2146  * \brief accept (or visit) the current AST node using provided visitor
2147  *
2148  * Instead of visiting children of AST node, like Ast::visit_children,
2149  * accept allows to visit the current node itself using provided concrete
2150  * visitor.
2151  *
2152  * \param v Concrete visitor that will be used to recursively visit node
2153  *
2154  * \sa Ast::accept for example.
2155  */
2156  void accept(visitor::Visitor &v) override;
2157 
2158  /// \}
2159 
2160 private:
2161  /**
2162  * \brief Set this object as parent for all the children
2163  *
2164  * This should be called in every object (with children) constructor
2165  * to set parents. Since it is called only in the constructors it
2166  * should not be virtual to avoid ambiguities (issue #295).
2167  */
2168  void set_parent_in_children();
2169 };
2170 
2171 /** @} */ // end of ast_class
2172 
2173 } // namespace ast
2174 } // namespace nmodl
2175 #endif // !NMODL_AST_NAME_HPP
2176 #ifndef NMODL_AST_PRIME_NAME_HPP
2177 #define NMODL_AST_PRIME_NAME_HPP
2178 
2179 namespace nmodl {
2180 namespace ast {
2181 
2182 /**
2183  * @addtogroup ast_class
2184  * @ingroup ast
2185  * @{
2186  */
2187 
2188 /**
2189  * \brief Represents a prime variable (for ODE)
2190  *
2191  * In case of ODE specification, all state variables appearing on LHS
2192  * with \` as suffix are parsed by lexer as ast::PrimeName. For example,
2193  * in below NMODL construct, m\` is stored as ast::PrimeName with `m` as a
2194  * ast::PrimeName::value and `1` as an ast::PrimeName::order.
2195  *
2196  * \code
2197  * DERIVATIVE states {
2198  * m` = m + h
2199  * }
2200  * \endcode
2201  *
2202  */
2203 class PrimeName : public Identifier {
2204 private:
2205  /// Name of prime variable
2206  std::shared_ptr<String> value;
2207  /// order of ODE
2208  std::shared_ptr<Integer> order;
2209  /// token with location information
2210  std::shared_ptr<ModToken> token;
2211 
2212 public:
2213  /// \name Ctor & dtor
2214  /// \{
2215 
2216  explicit PrimeName(String *value, Integer *order);
2217  explicit PrimeName(const std::shared_ptr<String> &value,
2218  const std::shared_ptr<Integer> &order);
2219  PrimeName(const PrimeName &obj);
2220 
2221  PrimeName() = default;
2222 
2223  virtual ~PrimeName() = default;
2224 
2225  /// \}
2226 
2227  /**
2228  * \brief Check if the ast node is an instance of ast::PrimeName
2229  * \return true as object is of type ast::PrimeName
2230  */
2231  bool is_prime_name() const noexcept override { return true; }
2232 
2233  /**
2234  * \brief Return a copy of the current node
2235  *
2236  * Recursively make a new copy/clone of the current node including
2237  * all members and return a pointer to the node. This is used for
2238  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2239  * ast.
2240  *
2241  * @return pointer to the clone/copy of the current node
2242  */
2243  PrimeName *clone() const override { return new PrimeName(*this); }
2244 
2245  /// \name Getters
2246  /// \{
2247 
2248  /**
2249  * \brief Return type (ast::AstNodeType) of ast node
2250  *
2251  * Every node in the ast has a type defined in ast::AstNodeType and this
2252  * function is used to retrieve the same.
2253  *
2254  * \return ast node type i.e. ast::AstNodeType::PRIME_NAME
2255  *
2256  * \sa Ast::get_node_type_name
2257  */
2258  AstNodeType get_node_type() const noexcept override {
2259  return AstNodeType::PRIME_NAME;
2260  }
2261 
2262  /**
2263  * \brief Return type (ast::AstNodeType) of ast node as std::string
2264  *
2265  * Every node in the ast has a type defined in ast::AstNodeType.
2266  * This type name can be returned as a std::string for printing
2267  * node to text/json form.
2268  *
2269  * \return name of the node type as a string i.e. "PrimeName"
2270  *
2271  * \sa Ast::get_node_name
2272  */
2273  std::string get_node_type_name() const noexcept override {
2274  return "PrimeName";
2275  }
2276 
2277  /**
2278  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2279  */
2280  std::shared_ptr<Ast> get_shared_ptr() override {
2281  return std::static_pointer_cast<PrimeName>(shared_from_this());
2282  }
2283 
2284  /**
2285  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2286  */
2287  std::shared_ptr<const Ast> get_shared_ptr() const override {
2288  return std::static_pointer_cast<const PrimeName>(shared_from_this());
2289  }
2290 
2291  /**
2292  * \brief Return associated token for the current ast node
2293  *
2294  * Not all ast nodes have token information. For example,
2295  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
2296  * solution of ODEs. In this case, we return nullptr to store in the
2297  * nmodl::symtab::SymbolTable.
2298  *
2299  * \return pointer to token if exist otherwise nullptr
2300  */
2301  const ModToken *get_token() const noexcept override { return token.get(); }
2302 
2303  /**
2304  * \brief Return name of the node
2305  *
2306  * Some ast nodes have a member marked designated as node name. For example,
2307  * in case of this ast::String has value designated as a
2308  * node name.
2309  *
2310  * @return name of the node as std::string
2311  *
2312  * \sa Ast::get_node_type_name
2313  */
2314  std::string get_node_name() const override;
2315 
2316  /**
2317  * \brief Getter for member variable \ref PrimeName.value
2318  */
2319  const std::shared_ptr<String> &get_value() const noexcept { return value; }
2320 
2321  /**
2322  * \brief Getter for member variable \ref PrimeName.order
2323  */
2324  const std::shared_ptr<Integer> &get_order() const noexcept { return order; }
2325 
2326  /// \}
2327 
2328  /// \name Setters
2329  /// \{
2330 
2331  /**
2332  * \brief Set token for the current ast node
2333  */
2334  void set_token(const ModToken &tok) {
2335  token = std::make_shared<ModToken>(tok);
2336  }
2337 
2338  /**
2339  * \brief Setter for member variable \ref PrimeName.value (rvalue reference)
2340  */
2341  void set_value(std::shared_ptr<String> &&value);
2342 
2343  /**
2344  * \brief Setter for member variable \ref PrimeName.value
2345  */
2346  void set_value(const std::shared_ptr<String> &value);
2347 
2348  /**
2349  * \brief Setter for member variable \ref PrimeName.order (rvalue reference)
2350  */
2351  void set_order(std::shared_ptr<Integer> &&order);
2352 
2353  /**
2354  * \brief Setter for member variable \ref PrimeName.order
2355  */
2356  void set_order(const std::shared_ptr<Integer> &order);
2357 
2358  /// \}
2359 
2360  /// \name Visitor
2361  /// \{
2362 
2363  /**
2364  * \brief visit children i.e. member variables of current node using provided
2365  * visitor
2366  *
2367  * Different nodes in the AST have different members (i.e. children). This
2368  * method recursively visits children using provided visitor.
2369  *
2370  * \param v Concrete visitor that will be used to recursively visit children
2371  *
2372  * \sa Ast::visit_children for example.
2373  */
2374  void visit_children(visitor::Visitor &v) override;
2375 
2376  /**
2377  * \brief accept (or visit) the current AST node using provided visitor
2378  *
2379  * Instead of visiting children of AST node, like Ast::visit_children,
2380  * accept allows to visit the current node itself using provided concrete
2381  * visitor.
2382  *
2383  * \param v Concrete visitor that will be used to recursively visit node
2384  *
2385  * \sa Ast::accept for example.
2386  */
2387  void accept(visitor::Visitor &v) override;
2388 
2389  /// \}
2390 
2391 private:
2392  /**
2393  * \brief Set this object as parent for all the children
2394  *
2395  * This should be called in every object (with children) constructor
2396  * to set parents. Since it is called only in the constructors it
2397  * should not be virtual to avoid ambiguities (issue #295).
2398  */
2399  void set_parent_in_children();
2400 };
2401 
2402 /** @} */ // end of ast_class
2403 
2404 } // namespace ast
2405 } // namespace nmodl
2406 #endif // !NMODL_AST_PRIME_NAME_HPP
2407 #ifndef NMODL_AST_INDEXED_NAME_HPP
2408 #define NMODL_AST_INDEXED_NAME_HPP
2409 
2410 namespace nmodl {
2411 namespace ast {
2412 
2413 /**
2414  * @addtogroup ast_class
2415  * @ingroup ast
2416  * @{
2417  */
2418 
2419 /**
2420  * \brief Represents specific element of an array variable
2421  *
2422  * If variable is declared as an array or when array element is accessed,
2423  * it is stored in the ast as ast::IndexedName. For example, in below NMODL,
2424  * construct `m[4]` is stored as ast::IndexedName with `m` as
2425  * ast::IndexedName::name and `4` as ast::IndexedName::legth.
2426  *
2427  * \code
2428  * STATE {
2429  * m[4]
2430  * }
2431  * \endcode
2432  *
2433  */
2434 class IndexedName : public Identifier {
2435 private:
2436  /// Name of array variable
2437  std::shared_ptr<Identifier> name;
2438  /// legth of an array or index position
2439  std::shared_ptr<Expression> length;
2440  /// token with location information
2441  std::shared_ptr<ModToken> token;
2442 
2443 public:
2444  /// \name Ctor & dtor
2445  /// \{
2446 
2447  explicit IndexedName(Identifier *name, Expression *length);
2448  explicit IndexedName(const std::shared_ptr<Identifier> &name,
2449  const std::shared_ptr<Expression> &length);
2450  IndexedName(const IndexedName &obj);
2451 
2452  virtual ~IndexedName() = default;
2453 
2454  /// \}
2455 
2456  /**
2457  * \brief Check if the ast node is an instance of ast::IndexedName
2458  * \return true as object is of type ast::IndexedName
2459  */
2460  bool is_indexed_name() const noexcept override { return true; }
2461 
2462  /**
2463  * \brief Return a copy of the current node
2464  *
2465  * Recursively make a new copy/clone of the current node including
2466  * all members and return a pointer to the node. This is used for
2467  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2468  * ast.
2469  *
2470  * @return pointer to the clone/copy of the current node
2471  */
2472  IndexedName *clone() const override { return new IndexedName(*this); }
2473 
2474  /// \name Getters
2475  /// \{
2476 
2477  /**
2478  * \brief Return type (ast::AstNodeType) of ast node
2479  *
2480  * Every node in the ast has a type defined in ast::AstNodeType and this
2481  * function is used to retrieve the same.
2482  *
2483  * \return ast node type i.e. ast::AstNodeType::INDEXED_NAME
2484  *
2485  * \sa Ast::get_node_type_name
2486  */
2487  AstNodeType get_node_type() const noexcept override {
2489  }
2490 
2491  /**
2492  * \brief Return type (ast::AstNodeType) of ast node as std::string
2493  *
2494  * Every node in the ast has a type defined in ast::AstNodeType.
2495  * This type name can be returned as a std::string for printing
2496  * node to text/json form.
2497  *
2498  * \return name of the node type as a string i.e. "IndexedName"
2499  *
2500  * \sa Ast::get_node_name
2501  */
2502  std::string get_node_type_name() const noexcept override {
2503  return "IndexedName";
2504  }
2505 
2506  /**
2507  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2508  */
2509  std::shared_ptr<Ast> get_shared_ptr() override {
2510  return std::static_pointer_cast<IndexedName>(shared_from_this());
2511  }
2512 
2513  /**
2514  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2515  */
2516  std::shared_ptr<const Ast> get_shared_ptr() const override {
2517  return std::static_pointer_cast<const IndexedName>(shared_from_this());
2518  }
2519 
2520  /**
2521  * \brief Return associated token for the current ast node
2522  *
2523  * Not all ast nodes have token information. For example,
2524  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
2525  * solution of ODEs. In this case, we return nullptr to store in the
2526  * nmodl::symtab::SymbolTable.
2527  *
2528  * \return pointer to token if exist otherwise nullptr
2529  */
2530  const ModToken *get_token() const noexcept override { return token.get(); }
2531 
2532  /**
2533  * \brief Return name of the node
2534  *
2535  * Some ast nodes have a member marked designated as node name. For example,
2536  * in case of this ast::Identifier has name designated as a
2537  * node name.
2538  *
2539  * @return name of the node as std::string
2540  *
2541  * \sa Ast::get_node_type_name
2542  */
2543  std::string get_node_name() const override;
2544 
2545  /**
2546  * \brief Getter for member variable \ref IndexedName.name
2547  */
2548  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
2549 
2550  /**
2551  * \brief Getter for member variable \ref IndexedName.length
2552  */
2553  const std::shared_ptr<Expression> &get_length() const noexcept {
2554  return length;
2555  }
2556 
2557  /// \}
2558 
2559  /// \name Setters
2560  /// \{
2561 
2562  /**
2563  * \brief Set token for the current ast node
2564  */
2565  void set_token(const ModToken &tok) {
2566  token = std::make_shared<ModToken>(tok);
2567  }
2568 
2569  /**
2570  * \brief Setter for member variable \ref IndexedName.name (rvalue reference)
2571  */
2572  void set_name(std::shared_ptr<Identifier> &&name);
2573 
2574  /**
2575  * \brief Setter for member variable \ref IndexedName.name
2576  */
2577  void set_name(const std::shared_ptr<Identifier> &name);
2578 
2579  /**
2580  * \brief Setter for member variable \ref IndexedName.length (rvalue
2581  * reference)
2582  */
2583  void set_length(std::shared_ptr<Expression> &&length);
2584 
2585  /**
2586  * \brief Setter for member variable \ref IndexedName.length
2587  */
2588  void set_length(const std::shared_ptr<Expression> &length);
2589 
2590  /// \}
2591 
2592  /// \name Visitor
2593  /// \{
2594 
2595  /**
2596  * \brief visit children i.e. member variables of current node using provided
2597  * visitor
2598  *
2599  * Different nodes in the AST have different members (i.e. children). This
2600  * method recursively visits children using provided visitor.
2601  *
2602  * \param v Concrete visitor that will be used to recursively visit children
2603  *
2604  * \sa Ast::visit_children for example.
2605  */
2606  void visit_children(visitor::Visitor &v) override;
2607 
2608  /**
2609  * \brief accept (or visit) the current AST node using provided visitor
2610  *
2611  * Instead of visiting children of AST node, like Ast::visit_children,
2612  * accept allows to visit the current node itself using provided concrete
2613  * visitor.
2614  *
2615  * \param v Concrete visitor that will be used to recursively visit node
2616  *
2617  * \sa Ast::accept for example.
2618  */
2619  void accept(visitor::Visitor &v) override;
2620 
2621  /// \}
2622 
2623 private:
2624  /**
2625  * \brief Set this object as parent for all the children
2626  *
2627  * This should be called in every object (with children) constructor
2628  * to set parents. Since it is called only in the constructors it
2629  * should not be virtual to avoid ambiguities (issue #295).
2630  */
2631  void set_parent_in_children();
2632 };
2633 
2634 /** @} */ // end of ast_class
2635 
2636 } // namespace ast
2637 } // namespace nmodl
2638 #endif // !NMODL_AST_INDEXED_NAME_HPP
2639 #ifndef NMODL_AST_VAR_NAME_HPP
2640 #define NMODL_AST_VAR_NAME_HPP
2641 
2642 namespace nmodl {
2643 namespace ast {
2644 
2645 /**
2646  * @addtogroup ast_class
2647  * @ingroup ast
2648  * @{
2649  */
2650 
2651 /**
2652  * \brief Represents a variable
2653  *
2654  * This type was introduced to store variables of different types like
2655  * ast::Name or ast::IndexedName in the AST.
2656  *
2657  * \note With ast::Identifier as top level base class, this type can be
2658  * removed in the future refactoring.
2659  *
2660  */
2661 class VarName : public Identifier {
2662 private:
2663  /// Name of variable
2664  std::shared_ptr<Identifier> name;
2665  /// Value specified with `@`
2666  std::shared_ptr<Integer> at;
2667  /// index value in case of array
2668  std::shared_ptr<Expression> index;
2669  /// token with location information
2670  std::shared_ptr<ModToken> token;
2671 
2672 public:
2673  /// \name Ctor & dtor
2674  /// \{
2675 
2676  explicit VarName(Identifier *name, Integer *at, Expression *index);
2677  explicit VarName(const std::shared_ptr<Identifier> &name,
2678  const std::shared_ptr<Integer> &at,
2679  const std::shared_ptr<Expression> &index);
2680  VarName(const VarName &obj);
2681 
2682  virtual ~VarName() = default;
2683 
2684  /// \}
2685 
2686  /**
2687  * \brief Check if the ast node is an instance of ast::VarName
2688  * \return true as object is of type ast::VarName
2689  */
2690  bool is_var_name() const noexcept override { return true; }
2691 
2692  /**
2693  * \brief Return a copy of the current node
2694  *
2695  * Recursively make a new copy/clone of the current node including
2696  * all members and return a pointer to the node. This is used for
2697  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2698  * ast.
2699  *
2700  * @return pointer to the clone/copy of the current node
2701  */
2702  VarName *clone() const override { return new VarName(*this); }
2703 
2704  /// \name Getters
2705  /// \{
2706 
2707  /**
2708  * \brief Return type (ast::AstNodeType) of ast node
2709  *
2710  * Every node in the ast has a type defined in ast::AstNodeType and this
2711  * function is used to retrieve the same.
2712  *
2713  * \return ast node type i.e. ast::AstNodeType::VAR_NAME
2714  *
2715  * \sa Ast::get_node_type_name
2716  */
2717  AstNodeType get_node_type() const noexcept override {
2718  return AstNodeType::VAR_NAME;
2719  }
2720 
2721  /**
2722  * \brief Return type (ast::AstNodeType) of ast node as std::string
2723  *
2724  * Every node in the ast has a type defined in ast::AstNodeType.
2725  * This type name can be returned as a std::string for printing
2726  * node to text/json form.
2727  *
2728  * \return name of the node type as a string i.e. "VarName"
2729  *
2730  * \sa Ast::get_node_name
2731  */
2732  std::string get_node_type_name() const noexcept override { return "VarName"; }
2733 
2734  /**
2735  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2736  */
2737  std::shared_ptr<Ast> get_shared_ptr() override {
2738  return std::static_pointer_cast<VarName>(shared_from_this());
2739  }
2740 
2741  /**
2742  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2743  */
2744  std::shared_ptr<const Ast> get_shared_ptr() const override {
2745  return std::static_pointer_cast<const VarName>(shared_from_this());
2746  }
2747 
2748  /**
2749  * \brief Return associated token for the current ast node
2750  *
2751  * Not all ast nodes have token information. For example,
2752  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
2753  * solution of ODEs. In this case, we return nullptr to store in the
2754  * nmodl::symtab::SymbolTable.
2755  *
2756  * \return pointer to token if exist otherwise nullptr
2757  */
2758  const ModToken *get_token() const noexcept override { return token.get(); }
2759 
2760  /**
2761  * \brief Return name of the node
2762  *
2763  * Some ast nodes have a member marked designated as node name. For example,
2764  * in case of this ast::Identifier has name designated as a
2765  * node name.
2766  *
2767  * @return name of the node as std::string
2768  *
2769  * \sa Ast::get_node_type_name
2770  */
2771  std::string get_node_name() const override;
2772 
2773  /**
2774  * \brief Getter for member variable \ref VarName.name
2775  */
2776  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
2777 
2778  /**
2779  * \brief Getter for member variable \ref VarName.at
2780  */
2781  const std::shared_ptr<Integer> &get_at() const noexcept { return at; }
2782 
2783  /**
2784  * \brief Getter for member variable \ref VarName.index
2785  */
2786  const std::shared_ptr<Expression> &get_index() const noexcept {
2787  return index;
2788  }
2789 
2790  /// \}
2791 
2792  /// \name Setters
2793  /// \{
2794 
2795  /**
2796  * \brief Set token for the current ast node
2797  */
2798  void set_token(const ModToken &tok) {
2799  token = std::make_shared<ModToken>(tok);
2800  }
2801 
2802  /**
2803  * \brief Setter for member variable \ref VarName.name (rvalue reference)
2804  */
2805  void set_name(std::shared_ptr<Identifier> &&name);
2806 
2807  /**
2808  * \brief Setter for member variable \ref VarName.name
2809  */
2810  void set_name(const std::shared_ptr<Identifier> &name);
2811 
2812  /**
2813  * \brief Setter for member variable \ref VarName.at (rvalue reference)
2814  */
2815  void set_at(std::shared_ptr<Integer> &&at);
2816 
2817  /**
2818  * \brief Setter for member variable \ref VarName.at
2819  */
2820  void set_at(const std::shared_ptr<Integer> &at);
2821 
2822  /**
2823  * \brief Setter for member variable \ref VarName.index (rvalue reference)
2824  */
2825  void set_index(std::shared_ptr<Expression> &&index);
2826 
2827  /**
2828  * \brief Setter for member variable \ref VarName.index
2829  */
2830  void set_index(const std::shared_ptr<Expression> &index);
2831 
2832  /// \}
2833 
2834  /// \name Visitor
2835  /// \{
2836 
2837  /**
2838  * \brief visit children i.e. member variables of current node using provided
2839  * visitor
2840  *
2841  * Different nodes in the AST have different members (i.e. children). This
2842  * method recursively visits children using provided visitor.
2843  *
2844  * \param v Concrete visitor that will be used to recursively visit children
2845  *
2846  * \sa Ast::visit_children for example.
2847  */
2848  void visit_children(visitor::Visitor &v) override;
2849 
2850  /**
2851  * \brief accept (or visit) the current AST node using provided visitor
2852  *
2853  * Instead of visiting children of AST node, like Ast::visit_children,
2854  * accept allows to visit the current node itself using provided concrete
2855  * visitor.
2856  *
2857  * \param v Concrete visitor that will be used to recursively visit node
2858  *
2859  * \sa Ast::accept for example.
2860  */
2861  void accept(visitor::Visitor &v) override;
2862 
2863  /// \}
2864 
2865 private:
2866  /**
2867  * \brief Set this object as parent for all the children
2868  *
2869  * This should be called in every object (with children) constructor
2870  * to set parents. Since it is called only in the constructors it
2871  * should not be virtual to avoid ambiguities (issue #295).
2872  */
2873  void set_parent_in_children();
2874 };
2875 
2876 /** @} */ // end of ast_class
2877 
2878 } // namespace ast
2879 } // namespace nmodl
2880 #endif // !NMODL_AST_VAR_NAME_HPP
2881 #ifndef NMODL_AST_ARGUMENT_HPP
2882 #define NMODL_AST_ARGUMENT_HPP
2883 
2884 namespace nmodl {
2885 namespace ast {
2886 
2887 /**
2888  * @addtogroup ast_class
2889  * @ingroup ast
2890  * @{
2891  */
2892 
2893 /**
2894  * \brief Represents an argument to functions and procedures
2895  *
2896  * In case of function definitions from different ast nodes like
2897  * ast::FunctionBlock, ast::ProcedureBlock, the arguments are store in the
2898  * ast::Argument. For example, in below NMODL construct, `weight` is stored as
2899  * ast::Argument::name and `uS` is stored as ast::Argument::unit:
2900  *
2901  * \code {.mod}
2902  * NET_RECEIVE(weight (uS)) {
2903  * g = g + weight
2904  * }
2905  * \endcode
2906  *
2907  */
2908 class Argument : public Identifier {
2909 private:
2910  /// Name of the argument
2911  std::shared_ptr<Identifier> name;
2912  /// Unit of the argument
2913  std::shared_ptr<Unit> unit;
2914  /// token with location information
2915  std::shared_ptr<ModToken> token;
2916 
2917 public:
2918  /// \name Ctor & dtor
2919  /// \{
2920 
2921  explicit Argument(Identifier *name, Unit *unit);
2922  explicit Argument(const std::shared_ptr<Identifier> &name,
2923  const std::shared_ptr<Unit> &unit);
2924  Argument(const Argument &obj);
2925 
2926  virtual ~Argument() = default;
2927 
2928  /// \}
2929 
2930  /**
2931  * \brief Check if the ast node is an instance of ast::Argument
2932  * \return true as object is of type ast::Argument
2933  */
2934  bool is_argument() const noexcept override { return true; }
2935 
2936  /**
2937  * \brief Return a copy of the current node
2938  *
2939  * Recursively make a new copy/clone of the current node including
2940  * all members and return a pointer to the node. This is used for
2941  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2942  * ast.
2943  *
2944  * @return pointer to the clone/copy of the current node
2945  */
2946  Argument *clone() const override { return new Argument(*this); }
2947 
2948  /// \name Getters
2949  /// \{
2950 
2951  /**
2952  * \brief Return type (ast::AstNodeType) of ast node
2953  *
2954  * Every node in the ast has a type defined in ast::AstNodeType and this
2955  * function is used to retrieve the same.
2956  *
2957  * \return ast node type i.e. ast::AstNodeType::ARGUMENT
2958  *
2959  * \sa Ast::get_node_type_name
2960  */
2961  AstNodeType get_node_type() const noexcept override {
2962  return AstNodeType::ARGUMENT;
2963  }
2964 
2965  /**
2966  * \brief Return type (ast::AstNodeType) of ast node as std::string
2967  *
2968  * Every node in the ast has a type defined in ast::AstNodeType.
2969  * This type name can be returned as a std::string for printing
2970  * node to text/json form.
2971  *
2972  * \return name of the node type as a string i.e. "Argument"
2973  *
2974  * \sa Ast::get_node_name
2975  */
2976  std::string get_node_type_name() const noexcept override {
2977  return "Argument";
2978  }
2979 
2980  /**
2981  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2982  */
2983  std::shared_ptr<Ast> get_shared_ptr() override {
2984  return std::static_pointer_cast<Argument>(shared_from_this());
2985  }
2986 
2987  /**
2988  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2989  */
2990  std::shared_ptr<const Ast> get_shared_ptr() const override {
2991  return std::static_pointer_cast<const Argument>(shared_from_this());
2992  }
2993 
2994  /**
2995  * \brief Return associated token for the current ast node
2996  *
2997  * Not all ast nodes have token information. For example,
2998  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
2999  * solution of ODEs. In this case, we return nullptr to store in the
3000  * nmodl::symtab::SymbolTable.
3001  *
3002  * \return pointer to token if exist otherwise nullptr
3003  */
3004  const ModToken *get_token() const noexcept override { return token.get(); }
3005 
3006  /**
3007  * \brief Return name of the node
3008  *
3009  * Some ast nodes have a member marked designated as node name. For example,
3010  * in case of this ast::Identifier has name designated as a
3011  * node name.
3012  *
3013  * @return name of the node as std::string
3014  *
3015  * \sa Ast::get_node_type_name
3016  */
3017  std::string get_node_name() const override;
3018 
3019  /**
3020  * \brief Getter for member variable \ref Argument.name
3021  */
3022  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
3023 
3024  /**
3025  * \brief Getter for member variable \ref Argument.unit
3026  */
3027  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
3028 
3029  /// \}
3030 
3031  /// \name Setters
3032  /// \{
3033 
3034  /**
3035  * \brief Set token for the current ast node
3036  */
3037  void set_token(const ModToken &tok) {
3038  token = std::make_shared<ModToken>(tok);
3039  }
3040 
3041  /**
3042  * \brief Setter for member variable \ref Argument.name (rvalue reference)
3043  */
3044  void set_name(std::shared_ptr<Identifier> &&name);
3045 
3046  /**
3047  * \brief Setter for member variable \ref Argument.name
3048  */
3049  void set_name(const std::shared_ptr<Identifier> &name);
3050 
3051  /**
3052  * \brief Setter for member variable \ref Argument.unit (rvalue reference)
3053  */
3054  void set_unit(std::shared_ptr<Unit> &&unit);
3055 
3056  /**
3057  * \brief Setter for member variable \ref Argument.unit
3058  */
3059  void set_unit(const std::shared_ptr<Unit> &unit);
3060 
3061  /// \}
3062 
3063  /// \name Visitor
3064  /// \{
3065 
3066  /**
3067  * \brief visit children i.e. member variables of current node using provided
3068  * visitor
3069  *
3070  * Different nodes in the AST have different members (i.e. children). This
3071  * method recursively visits children using provided visitor.
3072  *
3073  * \param v Concrete visitor that will be used to recursively visit children
3074  *
3075  * \sa Ast::visit_children for example.
3076  */
3077  void visit_children(visitor::Visitor &v) override;
3078 
3079  /**
3080  * \brief accept (or visit) the current AST node using provided visitor
3081  *
3082  * Instead of visiting children of AST node, like Ast::visit_children,
3083  * accept allows to visit the current node itself using provided concrete
3084  * visitor.
3085  *
3086  * \param v Concrete visitor that will be used to recursively visit node
3087  *
3088  * \sa Ast::accept for example.
3089  */
3090  void accept(visitor::Visitor &v) override;
3091 
3092  /// \}
3093 
3094 private:
3095  /**
3096  * \brief Set this object as parent for all the children
3097  *
3098  * This should be called in every object (with children) constructor
3099  * to set parents. Since it is called only in the constructors it
3100  * should not be virtual to avoid ambiguities (issue #295).
3101  */
3102  void set_parent_in_children();
3103 };
3104 
3105 /** @} */ // end of ast_class
3106 
3107 } // namespace ast
3108 } // namespace nmodl
3109 #endif // !NMODL_AST_ARGUMENT_HPP
3110 #ifndef NMODL_AST_REACT_VAR_NAME_HPP
3111 #define NMODL_AST_REACT_VAR_NAME_HPP
3112 
3113 namespace nmodl {
3114 namespace ast {
3115 
3116 /**
3117  * @addtogroup ast_class
3118  * @ingroup ast
3119  * @{
3120  */
3121 
3122 /**
3123  * \brief TODO
3124  *
3125  *
3126  */
3127 class ReactVarName : public Identifier {
3128 private:
3129  /// TODO
3130  std::shared_ptr<Integer> value;
3131  /// TODO
3132  std::shared_ptr<VarName> name;
3133  /// token with location information
3134  std::shared_ptr<ModToken> token;
3135 
3136 public:
3137  /// \name Ctor & dtor
3138  /// \{
3139 
3140  explicit ReactVarName(Integer *value, VarName *name);
3141  explicit ReactVarName(const std::shared_ptr<Integer> &value,
3142  const std::shared_ptr<VarName> &name);
3143  ReactVarName(const ReactVarName &obj);
3144 
3145  virtual ~ReactVarName() = default;
3146 
3147  /// \}
3148 
3149  /**
3150  * \brief Check if the ast node is an instance of ast::ReactVarName
3151  * \return true as object is of type ast::ReactVarName
3152  */
3153  bool is_react_var_name() const noexcept override { return true; }
3154 
3155  /**
3156  * \brief Return a copy of the current node
3157  *
3158  * Recursively make a new copy/clone of the current node including
3159  * all members and return a pointer to the node. This is used for
3160  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3161  * ast.
3162  *
3163  * @return pointer to the clone/copy of the current node
3164  */
3165  ReactVarName *clone() const override { return new ReactVarName(*this); }
3166 
3167  /// \name Getters
3168  /// \{
3169 
3170  /**
3171  * \brief Return type (ast::AstNodeType) of ast node
3172  *
3173  * Every node in the ast has a type defined in ast::AstNodeType and this
3174  * function is used to retrieve the same.
3175  *
3176  * \return ast node type i.e. ast::AstNodeType::REACT_VAR_NAME
3177  *
3178  * \sa Ast::get_node_type_name
3179  */
3180  AstNodeType get_node_type() const noexcept override {
3182  }
3183 
3184  /**
3185  * \brief Return type (ast::AstNodeType) of ast node as std::string
3186  *
3187  * Every node in the ast has a type defined in ast::AstNodeType.
3188  * This type name can be returned as a std::string for printing
3189  * node to text/json form.
3190  *
3191  * \return name of the node type as a string i.e. "ReactVarName"
3192  *
3193  * \sa Ast::get_node_name
3194  */
3195  std::string get_node_type_name() const noexcept override {
3196  return "ReactVarName";
3197  }
3198 
3199  /**
3200  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3201  */
3202  std::shared_ptr<Ast> get_shared_ptr() override {
3203  return std::static_pointer_cast<ReactVarName>(shared_from_this());
3204  }
3205 
3206  /**
3207  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3208  */
3209  std::shared_ptr<const Ast> get_shared_ptr() const override {
3210  return std::static_pointer_cast<const ReactVarName>(shared_from_this());
3211  }
3212 
3213  /**
3214  * \brief Return associated token for the current ast node
3215  *
3216  * Not all ast nodes have token information. For example,
3217  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
3218  * solution of ODEs. In this case, we return nullptr to store in the
3219  * nmodl::symtab::SymbolTable.
3220  *
3221  * \return pointer to token if exist otherwise nullptr
3222  */
3223  const ModToken *get_token() const noexcept override { return token.get(); }
3224 
3225  /**
3226  * \brief Getter for member variable \ref ReactVarName.value
3227  */
3228  const std::shared_ptr<Integer> &get_value() const noexcept { return value; }
3229 
3230  /**
3231  * \brief Return name of the node
3232  *
3233  * Some ast nodes have a member marked designated as node name. For example,
3234  * in case of this ast::VarName has name designated as a
3235  * node name.
3236  *
3237  * @return name of the node as std::string
3238  *
3239  * \sa Ast::get_node_type_name
3240  */
3241  std::string get_node_name() const override;
3242 
3243  /**
3244  * \brief Getter for member variable \ref ReactVarName.name
3245  */
3246  const std::shared_ptr<VarName> &get_name() const noexcept { return name; }
3247 
3248  /// \}
3249 
3250  /// \name Setters
3251  /// \{
3252 
3253  /**
3254  * \brief Set token for the current ast node
3255  */
3256  void set_token(const ModToken &tok) {
3257  token = std::make_shared<ModToken>(tok);
3258  }
3259 
3260  /**
3261  * \brief Setter for member variable \ref ReactVarName.value (rvalue
3262  * reference)
3263  */
3264  void set_value(std::shared_ptr<Integer> &&value);
3265 
3266  /**
3267  * \brief Setter for member variable \ref ReactVarName.value
3268  */
3269  void set_value(const std::shared_ptr<Integer> &value);
3270 
3271  /**
3272  * \brief Setter for member variable \ref ReactVarName.name (rvalue reference)
3273  */
3274  void set_name(std::shared_ptr<VarName> &&name);
3275 
3276  /**
3277  * \brief Setter for member variable \ref ReactVarName.name
3278  */
3279  void set_name(const std::shared_ptr<VarName> &name);
3280 
3281  /// \}
3282 
3283  /// \name Visitor
3284  /// \{
3285 
3286  /**
3287  * \brief visit children i.e. member variables of current node using provided
3288  * visitor
3289  *
3290  * Different nodes in the AST have different members (i.e. children). This
3291  * method recursively visits children using provided visitor.
3292  *
3293  * \param v Concrete visitor that will be used to recursively visit children
3294  *
3295  * \sa Ast::visit_children for example.
3296  */
3297  void visit_children(visitor::Visitor &v) override;
3298 
3299  /**
3300  * \brief accept (or visit) the current AST node using provided visitor
3301  *
3302  * Instead of visiting children of AST node, like Ast::visit_children,
3303  * accept allows to visit the current node itself using provided concrete
3304  * visitor.
3305  *
3306  * \param v Concrete visitor that will be used to recursively visit node
3307  *
3308  * \sa Ast::accept for example.
3309  */
3310  void accept(visitor::Visitor &v) override;
3311 
3312  /// \}
3313 
3314 private:
3315  /**
3316  * \brief Set this object as parent for all the children
3317  *
3318  * This should be called in every object (with children) constructor
3319  * to set parents. Since it is called only in the constructors it
3320  * should not be virtual to avoid ambiguities (issue #295).
3321  */
3322  void set_parent_in_children();
3323 };
3324 
3325 /** @} */ // end of ast_class
3326 
3327 } // namespace ast
3328 } // namespace nmodl
3329 #endif // !NMODL_AST_REACT_VAR_NAME_HPP
3330 #ifndef NMODL_AST_READ_ION_VAR_HPP
3331 #define NMODL_AST_READ_ION_VAR_HPP
3332 
3333 namespace nmodl {
3334 namespace ast {
3335 
3336 /**
3337  * @addtogroup ast_class
3338  * @ingroup ast
3339  * @{
3340  */
3341 
3342 /**
3343  * \brief TODO
3344  *
3345  *
3346  */
3347 class ReadIonVar : public Identifier {
3348 private:
3349  /// TODO
3350  std::shared_ptr<Name> name;
3351  /// token with location information
3352  std::shared_ptr<ModToken> token;
3353 
3354 public:
3355  /// \name Ctor & dtor
3356  /// \{
3357 
3358  explicit ReadIonVar(Name *name);
3359  explicit ReadIonVar(const std::shared_ptr<Name> &name);
3360  ReadIonVar(const ReadIonVar &obj);
3361 
3362  virtual ~ReadIonVar() = default;
3363 
3364  /// \}
3365 
3366  /**
3367  * \brief Check if the ast node is an instance of ast::ReadIonVar
3368  * \return true as object is of type ast::ReadIonVar
3369  */
3370  bool is_read_ion_var() const noexcept override { return true; }
3371 
3372  /**
3373  * \brief Return a copy of the current node
3374  *
3375  * Recursively make a new copy/clone of the current node including
3376  * all members and return a pointer to the node. This is used for
3377  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3378  * ast.
3379  *
3380  * @return pointer to the clone/copy of the current node
3381  */
3382  ReadIonVar *clone() const override { return new ReadIonVar(*this); }
3383 
3384  /// \name Getters
3385  /// \{
3386 
3387  /**
3388  * \brief Return type (ast::AstNodeType) of ast node
3389  *
3390  * Every node in the ast has a type defined in ast::AstNodeType and this
3391  * function is used to retrieve the same.
3392  *
3393  * \return ast node type i.e. ast::AstNodeType::READ_ION_VAR
3394  *
3395  * \sa Ast::get_node_type_name
3396  */
3397  AstNodeType get_node_type() const noexcept override {
3399  }
3400 
3401  /**
3402  * \brief Return type (ast::AstNodeType) of ast node as std::string
3403  *
3404  * Every node in the ast has a type defined in ast::AstNodeType.
3405  * This type name can be returned as a std::string for printing
3406  * node to text/json form.
3407  *
3408  * \return name of the node type as a string i.e. "ReadIonVar"
3409  *
3410  * \sa Ast::get_node_name
3411  */
3412  std::string get_node_type_name() const noexcept override {
3413  return "ReadIonVar";
3414  }
3415 
3416  /**
3417  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3418  */
3419  std::shared_ptr<Ast> get_shared_ptr() override {
3420  return std::static_pointer_cast<ReadIonVar>(shared_from_this());
3421  }
3422 
3423  /**
3424  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3425  */
3426  std::shared_ptr<const Ast> get_shared_ptr() const override {
3427  return std::static_pointer_cast<const ReadIonVar>(shared_from_this());
3428  }
3429 
3430  /**
3431  * \brief Return associated token for the current ast node
3432  *
3433  * Not all ast nodes have token information. For example,
3434  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
3435  * solution of ODEs. In this case, we return nullptr to store in the
3436  * nmodl::symtab::SymbolTable.
3437  *
3438  * \return pointer to token if exist otherwise nullptr
3439  */
3440  const ModToken *get_token() const noexcept override { return token.get(); }
3441 
3442  /**
3443  * \brief Return name of the node
3444  *
3445  * Some ast nodes have a member marked designated as node name. For example,
3446  * in case of this ast::Name has name designated as a
3447  * node name.
3448  *
3449  * @return name of the node as std::string
3450  *
3451  * \sa Ast::get_node_type_name
3452  */
3453  std::string get_node_name() const override;
3454 
3455  /**
3456  * \brief Getter for member variable \ref ReadIonVar.name
3457  */
3458  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
3459 
3460  /// \}
3461 
3462  /// \name Setters
3463  /// \{
3464 
3465  /**
3466  * \brief Set token for the current ast node
3467  */
3468  void set_token(const ModToken &tok) {
3469  token = std::make_shared<ModToken>(tok);
3470  }
3471 
3472  /**
3473  * \brief Setter for member variable \ref ReadIonVar.name (rvalue reference)
3474  */
3475  void set_name(std::shared_ptr<Name> &&name);
3476 
3477  /**
3478  * \brief Setter for member variable \ref ReadIonVar.name
3479  */
3480  void set_name(const std::shared_ptr<Name> &name);
3481 
3482  /// \}
3483 
3484  /// \name Visitor
3485  /// \{
3486 
3487  /**
3488  * \brief visit children i.e. member variables of current node using provided
3489  * visitor
3490  *
3491  * Different nodes in the AST have different members (i.e. children). This
3492  * method recursively visits children using provided visitor.
3493  *
3494  * \param v Concrete visitor that will be used to recursively visit children
3495  *
3496  * \sa Ast::visit_children for example.
3497  */
3498  void visit_children(visitor::Visitor &v) override;
3499 
3500  /**
3501  * \brief accept (or visit) the current AST node using provided visitor
3502  *
3503  * Instead of visiting children of AST node, like Ast::visit_children,
3504  * accept allows to visit the current node itself using provided concrete
3505  * visitor.
3506  *
3507  * \param v Concrete visitor that will be used to recursively visit node
3508  *
3509  * \sa Ast::accept for example.
3510  */
3511  void accept(visitor::Visitor &v) override;
3512 
3513  /// \}
3514 
3515 private:
3516  /**
3517  * \brief Set this object as parent for all the children
3518  *
3519  * This should be called in every object (with children) constructor
3520  * to set parents. Since it is called only in the constructors it
3521  * should not be virtual to avoid ambiguities (issue #295).
3522  */
3523  void set_parent_in_children();
3524 };
3525 
3526 /** @} */ // end of ast_class
3527 
3528 } // namespace ast
3529 } // namespace nmodl
3530 #endif // !NMODL_AST_READ_ION_VAR_HPP
3531 #ifndef NMODL_AST_WRITE_ION_VAR_HPP
3532 #define NMODL_AST_WRITE_ION_VAR_HPP
3533 
3534 namespace nmodl {
3535 namespace ast {
3536 
3537 /**
3538  * @addtogroup ast_class
3539  * @ingroup ast
3540  * @{
3541  */
3542 
3543 /**
3544  * \brief TODO
3545  *
3546  *
3547  */
3548 class WriteIonVar : public Identifier {
3549 private:
3550  /// TODO
3551  std::shared_ptr<Name> name;
3552  /// token with location information
3553  std::shared_ptr<ModToken> token;
3554 
3555 public:
3556  /// \name Ctor & dtor
3557  /// \{
3558 
3559  explicit WriteIonVar(Name *name);
3560  explicit WriteIonVar(const std::shared_ptr<Name> &name);
3561  WriteIonVar(const WriteIonVar &obj);
3562 
3563  virtual ~WriteIonVar() = default;
3564 
3565  /// \}
3566 
3567  /**
3568  * \brief Check if the ast node is an instance of ast::WriteIonVar
3569  * \return true as object is of type ast::WriteIonVar
3570  */
3571  bool is_write_ion_var() const noexcept override { return true; }
3572 
3573  /**
3574  * \brief Return a copy of the current node
3575  *
3576  * Recursively make a new copy/clone of the current node including
3577  * all members and return a pointer to the node. This is used for
3578  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3579  * ast.
3580  *
3581  * @return pointer to the clone/copy of the current node
3582  */
3583  WriteIonVar *clone() const override { return new WriteIonVar(*this); }
3584 
3585  /// \name Getters
3586  /// \{
3587 
3588  /**
3589  * \brief Return type (ast::AstNodeType) of ast node
3590  *
3591  * Every node in the ast has a type defined in ast::AstNodeType and this
3592  * function is used to retrieve the same.
3593  *
3594  * \return ast node type i.e. ast::AstNodeType::WRITE_ION_VAR
3595  *
3596  * \sa Ast::get_node_type_name
3597  */
3598  AstNodeType get_node_type() const noexcept override {
3600  }
3601 
3602  /**
3603  * \brief Return type (ast::AstNodeType) of ast node as std::string
3604  *
3605  * Every node in the ast has a type defined in ast::AstNodeType.
3606  * This type name can be returned as a std::string for printing
3607  * node to text/json form.
3608  *
3609  * \return name of the node type as a string i.e. "WriteIonVar"
3610  *
3611  * \sa Ast::get_node_name
3612  */
3613  std::string get_node_type_name() const noexcept override {
3614  return "WriteIonVar";
3615  }
3616 
3617  /**
3618  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3619  */
3620  std::shared_ptr<Ast> get_shared_ptr() override {
3621  return std::static_pointer_cast<WriteIonVar>(shared_from_this());
3622  }
3623 
3624  /**
3625  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3626  */
3627  std::shared_ptr<const Ast> get_shared_ptr() const override {
3628  return std::static_pointer_cast<const WriteIonVar>(shared_from_this());
3629  }
3630 
3631  /**
3632  * \brief Return associated token for the current ast node
3633  *
3634  * Not all ast nodes have token information. For example,
3635  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
3636  * solution of ODEs. In this case, we return nullptr to store in the
3637  * nmodl::symtab::SymbolTable.
3638  *
3639  * \return pointer to token if exist otherwise nullptr
3640  */
3641  const ModToken *get_token() const noexcept override { return token.get(); }
3642 
3643  /**
3644  * \brief Return name of the node
3645  *
3646  * Some ast nodes have a member marked designated as node name. For example,
3647  * in case of this ast::Name has name designated as a
3648  * node name.
3649  *
3650  * @return name of the node as std::string
3651  *
3652  * \sa Ast::get_node_type_name
3653  */
3654  std::string get_node_name() const override;
3655 
3656  /**
3657  * \brief Getter for member variable \ref WriteIonVar.name
3658  */
3659  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
3660 
3661  /// \}
3662 
3663  /// \name Setters
3664  /// \{
3665 
3666  /**
3667  * \brief Set token for the current ast node
3668  */
3669  void set_token(const ModToken &tok) {
3670  token = std::make_shared<ModToken>(tok);
3671  }
3672 
3673  /**
3674  * \brief Setter for member variable \ref WriteIonVar.name (rvalue reference)
3675  */
3676  void set_name(std::shared_ptr<Name> &&name);
3677 
3678  /**
3679  * \brief Setter for member variable \ref WriteIonVar.name
3680  */
3681  void set_name(const std::shared_ptr<Name> &name);
3682 
3683  /// \}
3684 
3685  /// \name Visitor
3686  /// \{
3687 
3688  /**
3689  * \brief visit children i.e. member variables of current node using provided
3690  * visitor
3691  *
3692  * Different nodes in the AST have different members (i.e. children). This
3693  * method recursively visits children using provided visitor.
3694  *
3695  * \param v Concrete visitor that will be used to recursively visit children
3696  *
3697  * \sa Ast::visit_children for example.
3698  */
3699  void visit_children(visitor::Visitor &v) override;
3700 
3701  /**
3702  * \brief accept (or visit) the current AST node using provided visitor
3703  *
3704  * Instead of visiting children of AST node, like Ast::visit_children,
3705  * accept allows to visit the current node itself using provided concrete
3706  * visitor.
3707  *
3708  * \param v Concrete visitor that will be used to recursively visit node
3709  *
3710  * \sa Ast::accept for example.
3711  */
3712  void accept(visitor::Visitor &v) override;
3713 
3714  /// \}
3715 
3716 private:
3717  /**
3718  * \brief Set this object as parent for all the children
3719  *
3720  * This should be called in every object (with children) constructor
3721  * to set parents. Since it is called only in the constructors it
3722  * should not be virtual to avoid ambiguities (issue #295).
3723  */
3724  void set_parent_in_children();
3725 };
3726 
3727 /** @} */ // end of ast_class
3728 
3729 } // namespace ast
3730 } // namespace nmodl
3731 #endif // !NMODL_AST_WRITE_ION_VAR_HPP
3732 #ifndef NMODL_AST_NONSPECIFIC_CUR_VAR_HPP
3733 #define NMODL_AST_NONSPECIFIC_CUR_VAR_HPP
3734 
3735 namespace nmodl {
3736 namespace ast {
3737 
3738 /**
3739  * @addtogroup ast_class
3740  * @ingroup ast
3741  * @{
3742  */
3743 
3744 /**
3745  * \brief TODO
3746  *
3747  *
3748  */
3750 private:
3751  /// TODO
3752  std::shared_ptr<Name> name;
3753  /// token with location information
3754  std::shared_ptr<ModToken> token;
3755 
3756 public:
3757  /// \name Ctor & dtor
3758  /// \{
3759 
3760  explicit NonspecificCurVar(Name *name);
3761  explicit NonspecificCurVar(const std::shared_ptr<Name> &name);
3763 
3764  virtual ~NonspecificCurVar() = default;
3765 
3766  /// \}
3767 
3768  /**
3769  * \brief Check if the ast node is an instance of ast::NonspecificCurVar
3770  * \return true as object is of type ast::NonspecificCurVar
3771  */
3772  bool is_nonspecific_cur_var() const noexcept override { return true; }
3773 
3774  /**
3775  * \brief Return a copy of the current node
3776  *
3777  * Recursively make a new copy/clone of the current node including
3778  * all members and return a pointer to the node. This is used for
3779  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3780  * ast.
3781  *
3782  * @return pointer to the clone/copy of the current node
3783  */
3784  NonspecificCurVar *clone() const override {
3785  return new NonspecificCurVar(*this);
3786  }
3787 
3788  /// \name Getters
3789  /// \{
3790 
3791  /**
3792  * \brief Return type (ast::AstNodeType) of ast node
3793  *
3794  * Every node in the ast has a type defined in ast::AstNodeType and this
3795  * function is used to retrieve the same.
3796  *
3797  * \return ast node type i.e. ast::AstNodeType::NONSPECIFIC_CUR_VAR
3798  *
3799  * \sa Ast::get_node_type_name
3800  */
3801  AstNodeType get_node_type() const noexcept override {
3803  }
3804 
3805  /**
3806  * \brief Return type (ast::AstNodeType) of ast node as std::string
3807  *
3808  * Every node in the ast has a type defined in ast::AstNodeType.
3809  * This type name can be returned as a std::string for printing
3810  * node to text/json form.
3811  *
3812  * \return name of the node type as a string i.e. "NonspecificCurVar"
3813  *
3814  * \sa Ast::get_node_name
3815  */
3816  std::string get_node_type_name() const noexcept override {
3817  return "NonspecificCurVar";
3818  }
3819 
3820  /**
3821  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3822  */
3823  std::shared_ptr<Ast> get_shared_ptr() override {
3824  return std::static_pointer_cast<NonspecificCurVar>(shared_from_this());
3825  }
3826 
3827  /**
3828  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3829  */
3830  std::shared_ptr<const Ast> get_shared_ptr() const override {
3831  return std::static_pointer_cast<const NonspecificCurVar>(
3832  shared_from_this());
3833  }
3834 
3835  /**
3836  * \brief Return associated token for the current ast node
3837  *
3838  * Not all ast nodes have token information. For example,
3839  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
3840  * solution of ODEs. In this case, we return nullptr to store in the
3841  * nmodl::symtab::SymbolTable.
3842  *
3843  * \return pointer to token if exist otherwise nullptr
3844  */
3845  const ModToken *get_token() const noexcept override { return token.get(); }
3846 
3847  /**
3848  * \brief Return name of the node
3849  *
3850  * Some ast nodes have a member marked designated as node name. For example,
3851  * in case of this ast::Name has name designated as a
3852  * node name.
3853  *
3854  * @return name of the node as std::string
3855  *
3856  * \sa Ast::get_node_type_name
3857  */
3858  std::string get_node_name() const override;
3859 
3860  /**
3861  * \brief Getter for member variable \ref NonspecificCurVar.name
3862  */
3863  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
3864 
3865  /// \}
3866 
3867  /// \name Setters
3868  /// \{
3869 
3870  /**
3871  * \brief Set token for the current ast node
3872  */
3873  void set_token(const ModToken &tok) {
3874  token = std::make_shared<ModToken>(tok);
3875  }
3876 
3877  /**
3878  * \brief Setter for member variable \ref NonspecificCurVar.name (rvalue
3879  * reference)
3880  */
3881  void set_name(std::shared_ptr<Name> &&name);
3882 
3883  /**
3884  * \brief Setter for member variable \ref NonspecificCurVar.name
3885  */
3886  void set_name(const std::shared_ptr<Name> &name);
3887 
3888  /// \}
3889 
3890  /// \name Visitor
3891  /// \{
3892 
3893  /**
3894  * \brief visit children i.e. member variables of current node using provided
3895  * visitor
3896  *
3897  * Different nodes in the AST have different members (i.e. children). This
3898  * method recursively visits children using provided visitor.
3899  *
3900  * \param v Concrete visitor that will be used to recursively visit children
3901  *
3902  * \sa Ast::visit_children for example.
3903  */
3904  void visit_children(visitor::Visitor &v) override;
3905 
3906  /**
3907  * \brief accept (or visit) the current AST node using provided visitor
3908  *
3909  * Instead of visiting children of AST node, like Ast::visit_children,
3910  * accept allows to visit the current node itself using provided concrete
3911  * visitor.
3912  *
3913  * \param v Concrete visitor that will be used to recursively visit node
3914  *
3915  * \sa Ast::accept for example.
3916  */
3917  void accept(visitor::Visitor &v) override;
3918 
3919  /// \}
3920 
3921 private:
3922  /**
3923  * \brief Set this object as parent for all the children
3924  *
3925  * This should be called in every object (with children) constructor
3926  * to set parents. Since it is called only in the constructors it
3927  * should not be virtual to avoid ambiguities (issue #295).
3928  */
3929  void set_parent_in_children();
3930 };
3931 
3932 /** @} */ // end of ast_class
3933 
3934 } // namespace ast
3935 } // namespace nmodl
3936 #endif // !NMODL_AST_NONSPECIFIC_CUR_VAR_HPP
3937 #ifndef NMODL_AST_ELECTRODE_CUR_VAR_HPP
3938 #define NMODL_AST_ELECTRODE_CUR_VAR_HPP
3939 
3940 namespace nmodl {
3941 namespace ast {
3942 
3943 /**
3944  * @addtogroup ast_class
3945  * @ingroup ast
3946  * @{
3947  */
3948 
3949 /**
3950  * \brief TODO
3951  *
3952  *
3953  */
3954 class ElectrodeCurVar : public Identifier {
3955 private:
3956  /// TODO
3957  std::shared_ptr<Name> name;
3958  /// token with location information
3959  std::shared_ptr<ModToken> token;
3960 
3961 public:
3962  /// \name Ctor & dtor
3963  /// \{
3964 
3965  explicit ElectrodeCurVar(Name *name);
3966  explicit ElectrodeCurVar(const std::shared_ptr<Name> &name);
3967  ElectrodeCurVar(const ElectrodeCurVar &obj);
3968 
3969  virtual ~ElectrodeCurVar() = default;
3970 
3971  /// \}
3972 
3973  /**
3974  * \brief Check if the ast node is an instance of ast::ElectrodeCurVar
3975  * \return true as object is of type ast::ElectrodeCurVar
3976  */
3977  bool is_electrode_cur_var() const noexcept override { return true; }
3978 
3979  /**
3980  * \brief Return a copy of the current node
3981  *
3982  * Recursively make a new copy/clone of the current node including
3983  * all members and return a pointer to the node. This is used for
3984  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3985  * ast.
3986  *
3987  * @return pointer to the clone/copy of the current node
3988  */
3989  ElectrodeCurVar *clone() const override { return new ElectrodeCurVar(*this); }
3990 
3991  /// \name Getters
3992  /// \{
3993 
3994  /**
3995  * \brief Return type (ast::AstNodeType) of ast node
3996  *
3997  * Every node in the ast has a type defined in ast::AstNodeType and this
3998  * function is used to retrieve the same.
3999  *
4000  * \return ast node type i.e. ast::AstNodeType::ELECTRODE_CUR_VAR
4001  *
4002  * \sa Ast::get_node_type_name
4003  */
4004  AstNodeType get_node_type() const noexcept override {
4006  }
4007 
4008  /**
4009  * \brief Return type (ast::AstNodeType) of ast node as std::string
4010  *
4011  * Every node in the ast has a type defined in ast::AstNodeType.
4012  * This type name can be returned as a std::string for printing
4013  * node to text/json form.
4014  *
4015  * \return name of the node type as a string i.e. "ElectrodeCurVar"
4016  *
4017  * \sa Ast::get_node_name
4018  */
4019  std::string get_node_type_name() const noexcept override {
4020  return "ElectrodeCurVar";
4021  }
4022 
4023  /**
4024  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4025  */
4026  std::shared_ptr<Ast> get_shared_ptr() override {
4027  return std::static_pointer_cast<ElectrodeCurVar>(shared_from_this());
4028  }
4029 
4030  /**
4031  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4032  */
4033  std::shared_ptr<const Ast> get_shared_ptr() const override {
4034  return std::static_pointer_cast<const ElectrodeCurVar>(shared_from_this());
4035  }
4036 
4037  /**
4038  * \brief Return associated token for the current ast node
4039  *
4040  * Not all ast nodes have token information. For example,
4041  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
4042  * solution of ODEs. In this case, we return nullptr to store in the
4043  * nmodl::symtab::SymbolTable.
4044  *
4045  * \return pointer to token if exist otherwise nullptr
4046  */
4047  const ModToken *get_token() const noexcept override { return token.get(); }
4048 
4049  /**
4050  * \brief Return name of the node
4051  *
4052  * Some ast nodes have a member marked designated as node name. For example,
4053  * in case of this ast::Name has name designated as a
4054  * node name.
4055  *
4056  * @return name of the node as std::string
4057  *
4058  * \sa Ast::get_node_type_name
4059  */
4060  std::string get_node_name() const override;
4061 
4062  /**
4063  * \brief Getter for member variable \ref ElectrodeCurVar.name
4064  */
4065  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4066 
4067  /// \}
4068 
4069  /// \name Setters
4070  /// \{
4071 
4072  /**
4073  * \brief Set token for the current ast node
4074  */
4075  void set_token(const ModToken &tok) {
4076  token = std::make_shared<ModToken>(tok);
4077  }
4078 
4079  /**
4080  * \brief Setter for member variable \ref ElectrodeCurVar.name (rvalue
4081  * reference)
4082  */
4083  void set_name(std::shared_ptr<Name> &&name);
4084 
4085  /**
4086  * \brief Setter for member variable \ref ElectrodeCurVar.name
4087  */
4088  void set_name(const std::shared_ptr<Name> &name);
4089 
4090  /// \}
4091 
4092  /// \name Visitor
4093  /// \{
4094 
4095  /**
4096  * \brief visit children i.e. member variables of current node using provided
4097  * visitor
4098  *
4099  * Different nodes in the AST have different members (i.e. children). This
4100  * method recursively visits children using provided visitor.
4101  *
4102  * \param v Concrete visitor that will be used to recursively visit children
4103  *
4104  * \sa Ast::visit_children for example.
4105  */
4106  void visit_children(visitor::Visitor &v) override;
4107 
4108  /**
4109  * \brief accept (or visit) the current AST node using provided visitor
4110  *
4111  * Instead of visiting children of AST node, like Ast::visit_children,
4112  * accept allows to visit the current node itself using provided concrete
4113  * visitor.
4114  *
4115  * \param v Concrete visitor that will be used to recursively visit node
4116  *
4117  * \sa Ast::accept for example.
4118  */
4119  void accept(visitor::Visitor &v) override;
4120 
4121  /// \}
4122 
4123 private:
4124  /**
4125  * \brief Set this object as parent for all the children
4126  *
4127  * This should be called in every object (with children) constructor
4128  * to set parents. Since it is called only in the constructors it
4129  * should not be virtual to avoid ambiguities (issue #295).
4130  */
4131  void set_parent_in_children();
4132 };
4133 
4134 /** @} */ // end of ast_class
4135 
4136 } // namespace ast
4137 } // namespace nmodl
4138 #endif // !NMODL_AST_ELECTRODE_CUR_VAR_HPP
4139 #ifndef NMODL_AST_SECTION_VAR_HPP
4140 #define NMODL_AST_SECTION_VAR_HPP
4141 
4142 namespace nmodl {
4143 namespace ast {
4144 
4145 /**
4146  * @addtogroup ast_class
4147  * @ingroup ast
4148  * @{
4149  */
4150 
4151 /**
4152  * \brief TODO
4153  *
4154  *
4155  */
4156 class SectionVar : public Identifier {
4157 private:
4158  /// TODO
4159  std::shared_ptr<Name> name;
4160  /// token with location information
4161  std::shared_ptr<ModToken> token;
4162 
4163 public:
4164  /// \name Ctor & dtor
4165  /// \{
4166 
4167  explicit SectionVar(Name *name);
4168  explicit SectionVar(const std::shared_ptr<Name> &name);
4169  SectionVar(const SectionVar &obj);
4170 
4171  virtual ~SectionVar() = default;
4172 
4173  /// \}
4174 
4175  /**
4176  * \brief Check if the ast node is an instance of ast::SectionVar
4177  * \return true as object is of type ast::SectionVar
4178  */
4179  bool is_section_var() const noexcept override { return true; }
4180 
4181  /**
4182  * \brief Return a copy of the current node
4183  *
4184  * Recursively make a new copy/clone of the current node including
4185  * all members and return a pointer to the node. This is used for
4186  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4187  * ast.
4188  *
4189  * @return pointer to the clone/copy of the current node
4190  */
4191  SectionVar *clone() const override { return new SectionVar(*this); }
4192 
4193  /// \name Getters
4194  /// \{
4195 
4196  /**
4197  * \brief Return type (ast::AstNodeType) of ast node
4198  *
4199  * Every node in the ast has a type defined in ast::AstNodeType and this
4200  * function is used to retrieve the same.
4201  *
4202  * \return ast node type i.e. ast::AstNodeType::SECTION_VAR
4203  *
4204  * \sa Ast::get_node_type_name
4205  */
4206  AstNodeType get_node_type() const noexcept override {
4207  return AstNodeType::SECTION_VAR;
4208  }
4209 
4210  /**
4211  * \brief Return type (ast::AstNodeType) of ast node as std::string
4212  *
4213  * Every node in the ast has a type defined in ast::AstNodeType.
4214  * This type name can be returned as a std::string for printing
4215  * node to text/json form.
4216  *
4217  * \return name of the node type as a string i.e. "SectionVar"
4218  *
4219  * \sa Ast::get_node_name
4220  */
4221  std::string get_node_type_name() const noexcept override {
4222  return "SectionVar";
4223  }
4224 
4225  /**
4226  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4227  */
4228  std::shared_ptr<Ast> get_shared_ptr() override {
4229  return std::static_pointer_cast<SectionVar>(shared_from_this());
4230  }
4231 
4232  /**
4233  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4234  */
4235  std::shared_ptr<const Ast> get_shared_ptr() const override {
4236  return std::static_pointer_cast<const SectionVar>(shared_from_this());
4237  }
4238 
4239  /**
4240  * \brief Return associated token for the current ast node
4241  *
4242  * Not all ast nodes have token information. For example,
4243  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
4244  * solution of ODEs. In this case, we return nullptr to store in the
4245  * nmodl::symtab::SymbolTable.
4246  *
4247  * \return pointer to token if exist otherwise nullptr
4248  */
4249  const ModToken *get_token() const noexcept override { return token.get(); }
4250 
4251  /**
4252  * \brief Return name of the node
4253  *
4254  * Some ast nodes have a member marked designated as node name. For example,
4255  * in case of this ast::Name has name designated as a
4256  * node name.
4257  *
4258  * @return name of the node as std::string
4259  *
4260  * \sa Ast::get_node_type_name
4261  */
4262  std::string get_node_name() const override;
4263 
4264  /**
4265  * \brief Getter for member variable \ref SectionVar.name
4266  */
4267  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4268 
4269  /// \}
4270 
4271  /// \name Setters
4272  /// \{
4273 
4274  /**
4275  * \brief Set token for the current ast node
4276  */
4277  void set_token(const ModToken &tok) {
4278  token = std::make_shared<ModToken>(tok);
4279  }
4280 
4281  /**
4282  * \brief Setter for member variable \ref SectionVar.name (rvalue reference)
4283  */
4284  void set_name(std::shared_ptr<Name> &&name);
4285 
4286  /**
4287  * \brief Setter for member variable \ref SectionVar.name
4288  */
4289  void set_name(const std::shared_ptr<Name> &name);
4290 
4291  /// \}
4292 
4293  /// \name Visitor
4294  /// \{
4295 
4296  /**
4297  * \brief visit children i.e. member variables of current node using provided
4298  * visitor
4299  *
4300  * Different nodes in the AST have different members (i.e. children). This
4301  * method recursively visits children using provided visitor.
4302  *
4303  * \param v Concrete visitor that will be used to recursively visit children
4304  *
4305  * \sa Ast::visit_children for example.
4306  */
4307  void visit_children(visitor::Visitor &v) override;
4308 
4309  /**
4310  * \brief accept (or visit) the current AST node using provided visitor
4311  *
4312  * Instead of visiting children of AST node, like Ast::visit_children,
4313  * accept allows to visit the current node itself using provided concrete
4314  * visitor.
4315  *
4316  * \param v Concrete visitor that will be used to recursively visit node
4317  *
4318  * \sa Ast::accept for example.
4319  */
4320  void accept(visitor::Visitor &v) override;
4321 
4322  /// \}
4323 
4324 private:
4325  /**
4326  * \brief Set this object as parent for all the children
4327  *
4328  * This should be called in every object (with children) constructor
4329  * to set parents. Since it is called only in the constructors it
4330  * should not be virtual to avoid ambiguities (issue #295).
4331  */
4332  void set_parent_in_children();
4333 };
4334 
4335 /** @} */ // end of ast_class
4336 
4337 } // namespace ast
4338 } // namespace nmodl
4339 #endif // !NMODL_AST_SECTION_VAR_HPP
4340 #ifndef NMODL_AST_RANGE_VAR_HPP
4341 #define NMODL_AST_RANGE_VAR_HPP
4342 
4343 namespace nmodl {
4344 namespace ast {
4345 
4346 /**
4347  * @addtogroup ast_class
4348  * @ingroup ast
4349  * @{
4350  */
4351 
4352 /**
4353  * \brief TODO
4354  *
4355  *
4356  */
4357 class RangeVar : public Identifier {
4358 private:
4359  /// TODO
4360  std::shared_ptr<Name> name;
4361  /// token with location information
4362  std::shared_ptr<ModToken> token;
4363 
4364 public:
4365  /// \name Ctor & dtor
4366  /// \{
4367 
4368  explicit RangeVar(Name *name);
4369  explicit RangeVar(const std::shared_ptr<Name> &name);
4370  RangeVar(const RangeVar &obj);
4371 
4372  virtual ~RangeVar() = default;
4373 
4374  /// \}
4375 
4376  /**
4377  * \brief Check if the ast node is an instance of ast::RangeVar
4378  * \return true as object is of type ast::RangeVar
4379  */
4380  bool is_range_var() const noexcept override { return true; }
4381 
4382  /**
4383  * \brief Return a copy of the current node
4384  *
4385  * Recursively make a new copy/clone of the current node including
4386  * all members and return a pointer to the node. This is used for
4387  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4388  * ast.
4389  *
4390  * @return pointer to the clone/copy of the current node
4391  */
4392  RangeVar *clone() const override { return new RangeVar(*this); }
4393 
4394  /// \name Getters
4395  /// \{
4396 
4397  /**
4398  * \brief Return type (ast::AstNodeType) of ast node
4399  *
4400  * Every node in the ast has a type defined in ast::AstNodeType and this
4401  * function is used to retrieve the same.
4402  *
4403  * \return ast node type i.e. ast::AstNodeType::RANGE_VAR
4404  *
4405  * \sa Ast::get_node_type_name
4406  */
4407  AstNodeType get_node_type() const noexcept override {
4408  return AstNodeType::RANGE_VAR;
4409  }
4410 
4411  /**
4412  * \brief Return type (ast::AstNodeType) of ast node as std::string
4413  *
4414  * Every node in the ast has a type defined in ast::AstNodeType.
4415  * This type name can be returned as a std::string for printing
4416  * node to text/json form.
4417  *
4418  * \return name of the node type as a string i.e. "RangeVar"
4419  *
4420  * \sa Ast::get_node_name
4421  */
4422  std::string get_node_type_name() const noexcept override {
4423  return "RangeVar";
4424  }
4425 
4426  /**
4427  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4428  */
4429  std::shared_ptr<Ast> get_shared_ptr() override {
4430  return std::static_pointer_cast<RangeVar>(shared_from_this());
4431  }
4432 
4433  /**
4434  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4435  */
4436  std::shared_ptr<const Ast> get_shared_ptr() const override {
4437  return std::static_pointer_cast<const RangeVar>(shared_from_this());
4438  }
4439 
4440  /**
4441  * \brief Return associated token for the current ast node
4442  *
4443  * Not all ast nodes have token information. For example,
4444  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
4445  * solution of ODEs. In this case, we return nullptr to store in the
4446  * nmodl::symtab::SymbolTable.
4447  *
4448  * \return pointer to token if exist otherwise nullptr
4449  */
4450  const ModToken *get_token() const noexcept override { return token.get(); }
4451 
4452  /**
4453  * \brief Return name of the node
4454  *
4455  * Some ast nodes have a member marked designated as node name. For example,
4456  * in case of this ast::Name has name designated as a
4457  * node name.
4458  *
4459  * @return name of the node as std::string
4460  *
4461  * \sa Ast::get_node_type_name
4462  */
4463  std::string get_node_name() const override;
4464 
4465  /**
4466  * \brief Getter for member variable \ref RangeVar.name
4467  */
4468  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4469 
4470  /// \}
4471 
4472  /// \name Setters
4473  /// \{
4474 
4475  /**
4476  * \brief Set token for the current ast node
4477  */
4478  void set_token(const ModToken &tok) {
4479  token = std::make_shared<ModToken>(tok);
4480  }
4481 
4482  /**
4483  * \brief Setter for member variable \ref RangeVar.name (rvalue reference)
4484  */
4485  void set_name(std::shared_ptr<Name> &&name);
4486 
4487  /**
4488  * \brief Setter for member variable \ref RangeVar.name
4489  */
4490  void set_name(const std::shared_ptr<Name> &name);
4491 
4492  /// \}
4493 
4494  /// \name Visitor
4495  /// \{
4496 
4497  /**
4498  * \brief visit children i.e. member variables of current node using provided
4499  * visitor
4500  *
4501  * Different nodes in the AST have different members (i.e. children). This
4502  * method recursively visits children using provided visitor.
4503  *
4504  * \param v Concrete visitor that will be used to recursively visit children
4505  *
4506  * \sa Ast::visit_children for example.
4507  */
4508  void visit_children(visitor::Visitor &v) override;
4509 
4510  /**
4511  * \brief accept (or visit) the current AST node using provided visitor
4512  *
4513  * Instead of visiting children of AST node, like Ast::visit_children,
4514  * accept allows to visit the current node itself using provided concrete
4515  * visitor.
4516  *
4517  * \param v Concrete visitor that will be used to recursively visit node
4518  *
4519  * \sa Ast::accept for example.
4520  */
4521  void accept(visitor::Visitor &v) override;
4522 
4523  /// \}
4524 
4525 private:
4526  /**
4527  * \brief Set this object as parent for all the children
4528  *
4529  * This should be called in every object (with children) constructor
4530  * to set parents. Since it is called only in the constructors it
4531  * should not be virtual to avoid ambiguities (issue #295).
4532  */
4533  void set_parent_in_children();
4534 };
4535 
4536 /** @} */ // end of ast_class
4537 
4538 } // namespace ast
4539 } // namespace nmodl
4540 #endif // !NMODL_AST_RANGE_VAR_HPP
4541 #ifndef NMODL_AST_GLOBAL_VAR_HPP
4542 #define NMODL_AST_GLOBAL_VAR_HPP
4543 
4544 namespace nmodl {
4545 namespace ast {
4546 
4547 /**
4548  * @addtogroup ast_class
4549  * @ingroup ast
4550  * @{
4551  */
4552 
4553 /**
4554  * \brief TODO
4555  *
4556  *
4557  */
4558 class GlobalVar : public Identifier {
4559 private:
4560  /// TODO
4561  std::shared_ptr<Name> name;
4562  /// token with location information
4563  std::shared_ptr<ModToken> token;
4564 
4565 public:
4566  /// \name Ctor & dtor
4567  /// \{
4568 
4569  explicit GlobalVar(Name *name);
4570  explicit GlobalVar(const std::shared_ptr<Name> &name);
4571  GlobalVar(const GlobalVar &obj);
4572 
4573  virtual ~GlobalVar() = default;
4574 
4575  /// \}
4576 
4577  /**
4578  * \brief Check if the ast node is an instance of ast::GlobalVar
4579  * \return true as object is of type ast::GlobalVar
4580  */
4581  bool is_global_var() const noexcept override { return true; }
4582 
4583  /**
4584  * \brief Return a copy of the current node
4585  *
4586  * Recursively make a new copy/clone of the current node including
4587  * all members and return a pointer to the node. This is used for
4588  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4589  * ast.
4590  *
4591  * @return pointer to the clone/copy of the current node
4592  */
4593  GlobalVar *clone() const override { return new GlobalVar(*this); }
4594 
4595  /// \name Getters
4596  /// \{
4597 
4598  /**
4599  * \brief Return type (ast::AstNodeType) of ast node
4600  *
4601  * Every node in the ast has a type defined in ast::AstNodeType and this
4602  * function is used to retrieve the same.
4603  *
4604  * \return ast node type i.e. ast::AstNodeType::GLOBAL_VAR
4605  *
4606  * \sa Ast::get_node_type_name
4607  */
4608  AstNodeType get_node_type() const noexcept override {
4609  return AstNodeType::GLOBAL_VAR;
4610  }
4611 
4612  /**
4613  * \brief Return type (ast::AstNodeType) of ast node as std::string
4614  *
4615  * Every node in the ast has a type defined in ast::AstNodeType.
4616  * This type name can be returned as a std::string for printing
4617  * node to text/json form.
4618  *
4619  * \return name of the node type as a string i.e. "GlobalVar"
4620  *
4621  * \sa Ast::get_node_name
4622  */
4623  std::string get_node_type_name() const noexcept override {
4624  return "GlobalVar";
4625  }
4626 
4627  /**
4628  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4629  */
4630  std::shared_ptr<Ast> get_shared_ptr() override {
4631  return std::static_pointer_cast<GlobalVar>(shared_from_this());
4632  }
4633 
4634  /**
4635  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4636  */
4637  std::shared_ptr<const Ast> get_shared_ptr() const override {
4638  return std::static_pointer_cast<const GlobalVar>(shared_from_this());
4639  }
4640 
4641  /**
4642  * \brief Return associated token for the current ast node
4643  *
4644  * Not all ast nodes have token information. For example,
4645  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
4646  * solution of ODEs. In this case, we return nullptr to store in the
4647  * nmodl::symtab::SymbolTable.
4648  *
4649  * \return pointer to token if exist otherwise nullptr
4650  */
4651  const ModToken *get_token() const noexcept override { return token.get(); }
4652 
4653  /**
4654  * \brief Return name of the node
4655  *
4656  * Some ast nodes have a member marked designated as node name. For example,
4657  * in case of this ast::Name has name designated as a
4658  * node name.
4659  *
4660  * @return name of the node as std::string
4661  *
4662  * \sa Ast::get_node_type_name
4663  */
4664  std::string get_node_name() const override;
4665 
4666  /**
4667  * \brief Getter for member variable \ref GlobalVar.name
4668  */
4669  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4670 
4671  /// \}
4672 
4673  /// \name Setters
4674  /// \{
4675 
4676  /**
4677  * \brief Set token for the current ast node
4678  */
4679  void set_token(const ModToken &tok) {
4680  token = std::make_shared<ModToken>(tok);
4681  }
4682 
4683  /**
4684  * \brief Setter for member variable \ref GlobalVar.name (rvalue reference)
4685  */
4686  void set_name(std::shared_ptr<Name> &&name);
4687 
4688  /**
4689  * \brief Setter for member variable \ref GlobalVar.name
4690  */
4691  void set_name(const std::shared_ptr<Name> &name);
4692 
4693  /// \}
4694 
4695  /// \name Visitor
4696  /// \{
4697 
4698  /**
4699  * \brief visit children i.e. member variables of current node using provided
4700  * visitor
4701  *
4702  * Different nodes in the AST have different members (i.e. children). This
4703  * method recursively visits children using provided visitor.
4704  *
4705  * \param v Concrete visitor that will be used to recursively visit children
4706  *
4707  * \sa Ast::visit_children for example.
4708  */
4709  void visit_children(visitor::Visitor &v) override;
4710 
4711  /**
4712  * \brief accept (or visit) the current AST node using provided visitor
4713  *
4714  * Instead of visiting children of AST node, like Ast::visit_children,
4715  * accept allows to visit the current node itself using provided concrete
4716  * visitor.
4717  *
4718  * \param v Concrete visitor that will be used to recursively visit node
4719  *
4720  * \sa Ast::accept for example.
4721  */
4722  void accept(visitor::Visitor &v) override;
4723 
4724  /// \}
4725 
4726 private:
4727  /**
4728  * \brief Set this object as parent for all the children
4729  *
4730  * This should be called in every object (with children) constructor
4731  * to set parents. Since it is called only in the constructors it
4732  * should not be virtual to avoid ambiguities (issue #295).
4733  */
4734  void set_parent_in_children();
4735 };
4736 
4737 /** @} */ // end of ast_class
4738 
4739 } // namespace ast
4740 } // namespace nmodl
4741 #endif // !NMODL_AST_GLOBAL_VAR_HPP
4742 #ifndef NMODL_AST_POINTER_VAR_HPP
4743 #define NMODL_AST_POINTER_VAR_HPP
4744 
4745 namespace nmodl {
4746 namespace ast {
4747 
4748 /**
4749  * @addtogroup ast_class
4750  * @ingroup ast
4751  * @{
4752  */
4753 
4754 /**
4755  * \brief TODO
4756  *
4757  *
4758  */
4759 class PointerVar : public Identifier {
4760 private:
4761  /// TODO
4762  std::shared_ptr<Name> name;
4763  /// token with location information
4764  std::shared_ptr<ModToken> token;
4765 
4766 public:
4767  /// \name Ctor & dtor
4768  /// \{
4769 
4770  explicit PointerVar(Name *name);
4771  explicit PointerVar(const std::shared_ptr<Name> &name);
4772  PointerVar(const PointerVar &obj);
4773 
4774  virtual ~PointerVar() = default;
4775 
4776  /// \}
4777 
4778  /**
4779  * \brief Check if the ast node is an instance of ast::PointerVar
4780  * \return true as object is of type ast::PointerVar
4781  */
4782  bool is_pointer_var() const noexcept override { return true; }
4783 
4784  /**
4785  * \brief Return a copy of the current node
4786  *
4787  * Recursively make a new copy/clone of the current node including
4788  * all members and return a pointer to the node. This is used for
4789  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4790  * ast.
4791  *
4792  * @return pointer to the clone/copy of the current node
4793  */
4794  PointerVar *clone() const override { return new PointerVar(*this); }
4795 
4796  /// \name Getters
4797  /// \{
4798 
4799  /**
4800  * \brief Return type (ast::AstNodeType) of ast node
4801  *
4802  * Every node in the ast has a type defined in ast::AstNodeType and this
4803  * function is used to retrieve the same.
4804  *
4805  * \return ast node type i.e. ast::AstNodeType::POINTER_VAR
4806  *
4807  * \sa Ast::get_node_type_name
4808  */
4809  AstNodeType get_node_type() const noexcept override {
4810  return AstNodeType::POINTER_VAR;
4811  }
4812 
4813  /**
4814  * \brief Return type (ast::AstNodeType) of ast node as std::string
4815  *
4816  * Every node in the ast has a type defined in ast::AstNodeType.
4817  * This type name can be returned as a std::string for printing
4818  * node to text/json form.
4819  *
4820  * \return name of the node type as a string i.e. "PointerVar"
4821  *
4822  * \sa Ast::get_node_name
4823  */
4824  std::string get_node_type_name() const noexcept override {
4825  return "PointerVar";
4826  }
4827 
4828  /**
4829  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4830  */
4831  std::shared_ptr<Ast> get_shared_ptr() override {
4832  return std::static_pointer_cast<PointerVar>(shared_from_this());
4833  }
4834 
4835  /**
4836  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4837  */
4838  std::shared_ptr<const Ast> get_shared_ptr() const override {
4839  return std::static_pointer_cast<const PointerVar>(shared_from_this());
4840  }
4841 
4842  /**
4843  * \brief Return associated token for the current ast node
4844  *
4845  * Not all ast nodes have token information. For example,
4846  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
4847  * solution of ODEs. In this case, we return nullptr to store in the
4848  * nmodl::symtab::SymbolTable.
4849  *
4850  * \return pointer to token if exist otherwise nullptr
4851  */
4852  const ModToken *get_token() const noexcept override { return token.get(); }
4853 
4854  /**
4855  * \brief Return name of the node
4856  *
4857  * Some ast nodes have a member marked designated as node name. For example,
4858  * in case of this ast::Name has name designated as a
4859  * node name.
4860  *
4861  * @return name of the node as std::string
4862  *
4863  * \sa Ast::get_node_type_name
4864  */
4865  std::string get_node_name() const override;
4866 
4867  /**
4868  * \brief Getter for member variable \ref PointerVar.name
4869  */
4870  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4871 
4872  /// \}
4873 
4874  /// \name Setters
4875  /// \{
4876 
4877  /**
4878  * \brief Set token for the current ast node
4879  */
4880  void set_token(const ModToken &tok) {
4881  token = std::make_shared<ModToken>(tok);
4882  }
4883 
4884  /**
4885  * \brief Setter for member variable \ref PointerVar.name (rvalue reference)
4886  */
4887  void set_name(std::shared_ptr<Name> &&name);
4888 
4889  /**
4890  * \brief Setter for member variable \ref PointerVar.name
4891  */
4892  void set_name(const std::shared_ptr<Name> &name);
4893 
4894  /// \}
4895 
4896  /// \name Visitor
4897  /// \{
4898 
4899  /**
4900  * \brief visit children i.e. member variables of current node using provided
4901  * visitor
4902  *
4903  * Different nodes in the AST have different members (i.e. children). This
4904  * method recursively visits children using provided visitor.
4905  *
4906  * \param v Concrete visitor that will be used to recursively visit children
4907  *
4908  * \sa Ast::visit_children for example.
4909  */
4910  void visit_children(visitor::Visitor &v) override;
4911 
4912  /**
4913  * \brief accept (or visit) the current AST node using provided visitor
4914  *
4915  * Instead of visiting children of AST node, like Ast::visit_children,
4916  * accept allows to visit the current node itself using provided concrete
4917  * visitor.
4918  *
4919  * \param v Concrete visitor that will be used to recursively visit node
4920  *
4921  * \sa Ast::accept for example.
4922  */
4923  void accept(visitor::Visitor &v) override;
4924 
4925  /// \}
4926 
4927 private:
4928  /**
4929  * \brief Set this object as parent for all the children
4930  *
4931  * This should be called in every object (with children) constructor
4932  * to set parents. Since it is called only in the constructors it
4933  * should not be virtual to avoid ambiguities (issue #295).
4934  */
4935  void set_parent_in_children();
4936 };
4937 
4938 /** @} */ // end of ast_class
4939 
4940 } // namespace ast
4941 } // namespace nmodl
4942 #endif // !NMODL_AST_POINTER_VAR_HPP
4943 #ifndef NMODL_AST_BBCORE_POINTER_VAR_HPP
4944 #define NMODL_AST_BBCORE_POINTER_VAR_HPP
4945 
4946 namespace nmodl {
4947 namespace ast {
4948 
4949 /**
4950  * @addtogroup ast_class
4951  * @ingroup ast
4952  * @{
4953  */
4954 
4955 /**
4956  * \brief Represent a single variable of type BBCOREPOINTER
4957  *
4958  * See ast::BbcorePointer for an example.
4959  *
4960  */
4962 private:
4963  /// Variable name
4964  std::shared_ptr<Name> name;
4965  /// token with location information
4966  std::shared_ptr<ModToken> token;
4967 
4968 public:
4969  /// \name Ctor & dtor
4970  /// \{
4971 
4972  explicit BbcorePointerVar(Name *name);
4973  explicit BbcorePointerVar(const std::shared_ptr<Name> &name);
4974  BbcorePointerVar(const BbcorePointerVar &obj);
4975 
4976  virtual ~BbcorePointerVar() = default;
4977 
4978  /// \}
4979 
4980  /**
4981  * \brief Check if the ast node is an instance of ast::BbcorePointerVar
4982  * \return true as object is of type ast::BbcorePointerVar
4983  */
4984  bool is_bbcore_pointer_var() const noexcept override { return true; }
4985 
4986  /**
4987  * \brief Return a copy of the current node
4988  *
4989  * Recursively make a new copy/clone of the current node including
4990  * all members and return a pointer to the node. This is used for
4991  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4992  * ast.
4993  *
4994  * @return pointer to the clone/copy of the current node
4995  */
4996  BbcorePointerVar *clone() const override {
4997  return new BbcorePointerVar(*this);
4998  }
4999 
5000  /// \name Getters
5001  /// \{
5002 
5003  /**
5004  * \brief Return type (ast::AstNodeType) of ast node
5005  *
5006  * Every node in the ast has a type defined in ast::AstNodeType and this
5007  * function is used to retrieve the same.
5008  *
5009  * \return ast node type i.e. ast::AstNodeType::BBCORE_POINTER_VAR
5010  *
5011  * \sa Ast::get_node_type_name
5012  */
5013  AstNodeType get_node_type() const noexcept override {
5015  }
5016 
5017  /**
5018  * \brief Return type (ast::AstNodeType) of ast node as std::string
5019  *
5020  * Every node in the ast has a type defined in ast::AstNodeType.
5021  * This type name can be returned as a std::string for printing
5022  * node to text/json form.
5023  *
5024  * \return name of the node type as a string i.e. "BbcorePointerVar"
5025  *
5026  * \sa Ast::get_node_name
5027  */
5028  std::string get_node_type_name() const noexcept override {
5029  return "BbcorePointerVar";
5030  }
5031 
5032  /**
5033  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5034  */
5035  std::shared_ptr<Ast> get_shared_ptr() override {
5036  return std::static_pointer_cast<BbcorePointerVar>(shared_from_this());
5037  }
5038 
5039  /**
5040  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5041  */
5042  std::shared_ptr<const Ast> get_shared_ptr() const override {
5043  return std::static_pointer_cast<const BbcorePointerVar>(shared_from_this());
5044  }
5045 
5046  /**
5047  * \brief Return associated token for the current ast node
5048  *
5049  * Not all ast nodes have token information. For example,
5050  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5051  * solution of ODEs. In this case, we return nullptr to store in the
5052  * nmodl::symtab::SymbolTable.
5053  *
5054  * \return pointer to token if exist otherwise nullptr
5055  */
5056  const ModToken *get_token() const noexcept override { return token.get(); }
5057 
5058  /**
5059  * \brief Return name of the node
5060  *
5061  * Some ast nodes have a member marked designated as node name. For example,
5062  * in case of this ast::Name has name designated as a
5063  * node name.
5064  *
5065  * @return name of the node as std::string
5066  *
5067  * \sa Ast::get_node_type_name
5068  */
5069  std::string get_node_name() const override;
5070 
5071  /**
5072  * \brief Getter for member variable \ref BbcorePointerVar.name
5073  */
5074  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
5075 
5076  /// \}
5077 
5078  /// \name Setters
5079  /// \{
5080 
5081  /**
5082  * \brief Set token for the current ast node
5083  */
5084  void set_token(const ModToken &tok) {
5085  token = std::make_shared<ModToken>(tok);
5086  }
5087 
5088  /**
5089  * \brief Setter for member variable \ref BbcorePointerVar.name (rvalue
5090  * reference)
5091  */
5092  void set_name(std::shared_ptr<Name> &&name);
5093 
5094  /**
5095  * \brief Setter for member variable \ref BbcorePointerVar.name
5096  */
5097  void set_name(const std::shared_ptr<Name> &name);
5098 
5099  /// \}
5100 
5101  /// \name Visitor
5102  /// \{
5103 
5104  /**
5105  * \brief visit children i.e. member variables of current node using provided
5106  * visitor
5107  *
5108  * Different nodes in the AST have different members (i.e. children). This
5109  * method recursively visits children using provided visitor.
5110  *
5111  * \param v Concrete visitor that will be used to recursively visit children
5112  *
5113  * \sa Ast::visit_children for example.
5114  */
5115  void visit_children(visitor::Visitor &v) override;
5116 
5117  /**
5118  * \brief accept (or visit) the current AST node using provided visitor
5119  *
5120  * Instead of visiting children of AST node, like Ast::visit_children,
5121  * accept allows to visit the current node itself using provided concrete
5122  * visitor.
5123  *
5124  * \param v Concrete visitor that will be used to recursively visit node
5125  *
5126  * \sa Ast::accept for example.
5127  */
5128  void accept(visitor::Visitor &v) override;
5129 
5130  /// \}
5131 
5132 private:
5133  /**
5134  * \brief Set this object as parent for all the children
5135  *
5136  * This should be called in every object (with children) constructor
5137  * to set parents. Since it is called only in the constructors it
5138  * should not be virtual to avoid ambiguities (issue #295).
5139  */
5140  void set_parent_in_children();
5141 };
5142 
5143 /** @} */ // end of ast_class
5144 
5145 } // namespace ast
5146 } // namespace nmodl
5147 #endif // !NMODL_AST_BBCORE_POINTER_VAR_HPP
5148 #ifndef NMODL_AST_EXTERN_VAR_HPP
5149 #define NMODL_AST_EXTERN_VAR_HPP
5150 
5151 namespace nmodl {
5152 namespace ast {
5153 
5154 /**
5155  * @addtogroup ast_class
5156  * @ingroup ast
5157  * @{
5158  */
5159 
5160 /**
5161  * \brief TODO
5162  *
5163  *
5164  */
5165 class ExternVar : public Identifier {
5166 private:
5167  /// TODO
5168  std::shared_ptr<Name> name;
5169  /// token with location information
5170  std::shared_ptr<ModToken> token;
5171 
5172 public:
5173  /// \name Ctor & dtor
5174  /// \{
5175 
5176  explicit ExternVar(Name *name);
5177  explicit ExternVar(const std::shared_ptr<Name> &name);
5178  ExternVar(const ExternVar &obj);
5179 
5180  virtual ~ExternVar() = default;
5181 
5182  /// \}
5183 
5184  /**
5185  * \brief Check if the ast node is an instance of ast::ExternVar
5186  * \return true as object is of type ast::ExternVar
5187  */
5188  bool is_extern_var() const noexcept override { return true; }
5189 
5190  /**
5191  * \brief Return a copy of the current node
5192  *
5193  * Recursively make a new copy/clone of the current node including
5194  * all members and return a pointer to the node. This is used for
5195  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5196  * ast.
5197  *
5198  * @return pointer to the clone/copy of the current node
5199  */
5200  ExternVar *clone() const override { return new ExternVar(*this); }
5201 
5202  /// \name Getters
5203  /// \{
5204 
5205  /**
5206  * \brief Return type (ast::AstNodeType) of ast node
5207  *
5208  * Every node in the ast has a type defined in ast::AstNodeType and this
5209  * function is used to retrieve the same.
5210  *
5211  * \return ast node type i.e. ast::AstNodeType::EXTERN_VAR
5212  *
5213  * \sa Ast::get_node_type_name
5214  */
5215  AstNodeType get_node_type() const noexcept override {
5216  return AstNodeType::EXTERN_VAR;
5217  }
5218 
5219  /**
5220  * \brief Return type (ast::AstNodeType) of ast node as std::string
5221  *
5222  * Every node in the ast has a type defined in ast::AstNodeType.
5223  * This type name can be returned as a std::string for printing
5224  * node to text/json form.
5225  *
5226  * \return name of the node type as a string i.e. "ExternVar"
5227  *
5228  * \sa Ast::get_node_name
5229  */
5230  std::string get_node_type_name() const noexcept override {
5231  return "ExternVar";
5232  }
5233 
5234  /**
5235  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5236  */
5237  std::shared_ptr<Ast> get_shared_ptr() override {
5238  return std::static_pointer_cast<ExternVar>(shared_from_this());
5239  }
5240 
5241  /**
5242  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5243  */
5244  std::shared_ptr<const Ast> get_shared_ptr() const override {
5245  return std::static_pointer_cast<const ExternVar>(shared_from_this());
5246  }
5247 
5248  /**
5249  * \brief Return associated token for the current ast node
5250  *
5251  * Not all ast nodes have token information. For example,
5252  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5253  * solution of ODEs. In this case, we return nullptr to store in the
5254  * nmodl::symtab::SymbolTable.
5255  *
5256  * \return pointer to token if exist otherwise nullptr
5257  */
5258  const ModToken *get_token() const noexcept override { return token.get(); }
5259 
5260  /**
5261  * \brief Return name of the node
5262  *
5263  * Some ast nodes have a member marked designated as node name. For example,
5264  * in case of this ast::Name has name designated as a
5265  * node name.
5266  *
5267  * @return name of the node as std::string
5268  *
5269  * \sa Ast::get_node_type_name
5270  */
5271  std::string get_node_name() const override;
5272 
5273  /**
5274  * \brief Getter for member variable \ref ExternVar.name
5275  */
5276  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
5277 
5278  /// \}
5279 
5280  /// \name Setters
5281  /// \{
5282 
5283  /**
5284  * \brief Set token for the current ast node
5285  */
5286  void set_token(const ModToken &tok) {
5287  token = std::make_shared<ModToken>(tok);
5288  }
5289 
5290  /**
5291  * \brief Setter for member variable \ref ExternVar.name (rvalue reference)
5292  */
5293  void set_name(std::shared_ptr<Name> &&name);
5294 
5295  /**
5296  * \brief Setter for member variable \ref ExternVar.name
5297  */
5298  void set_name(const std::shared_ptr<Name> &name);
5299 
5300  /// \}
5301 
5302  /// \name Visitor
5303  /// \{
5304 
5305  /**
5306  * \brief visit children i.e. member variables of current node using provided
5307  * visitor
5308  *
5309  * Different nodes in the AST have different members (i.e. children). This
5310  * method recursively visits children using provided visitor.
5311  *
5312  * \param v Concrete visitor that will be used to recursively visit children
5313  *
5314  * \sa Ast::visit_children for example.
5315  */
5316  void visit_children(visitor::Visitor &v) override;
5317 
5318  /**
5319  * \brief accept (or visit) the current AST node using provided visitor
5320  *
5321  * Instead of visiting children of AST node, like Ast::visit_children,
5322  * accept allows to visit the current node itself using provided concrete
5323  * visitor.
5324  *
5325  * \param v Concrete visitor that will be used to recursively visit node
5326  *
5327  * \sa Ast::accept for example.
5328  */
5329  void accept(visitor::Visitor &v) override;
5330 
5331  /// \}
5332 
5333 private:
5334  /**
5335  * \brief Set this object as parent for all the children
5336  *
5337  * This should be called in every object (with children) constructor
5338  * to set parents. Since it is called only in the constructors it
5339  * should not be virtual to avoid ambiguities (issue #295).
5340  */
5341  void set_parent_in_children();
5342 };
5343 
5344 /** @} */ // end of ast_class
5345 
5346 } // namespace ast
5347 } // namespace nmodl
5348 #endif // !NMODL_AST_EXTERN_VAR_HPP
5349 #ifndef NMODL_AST_THREADSAFE_VAR_HPP
5350 #define NMODL_AST_THREADSAFE_VAR_HPP
5351 
5352 namespace nmodl {
5353 namespace ast {
5354 
5355 /**
5356  * @addtogroup ast_class
5357  * @ingroup ast
5358  * @{
5359  */
5360 
5361 /**
5362  * \brief TODO
5363  *
5364  *
5365  */
5366 class ThreadsafeVar : public Identifier {
5367 private:
5368  /// TODO
5369  std::shared_ptr<Name> name;
5370  /// token with location information
5371  std::shared_ptr<ModToken> token;
5372 
5373 public:
5374  /// \name Ctor & dtor
5375  /// \{
5376 
5377  explicit ThreadsafeVar(Name *name);
5378  explicit ThreadsafeVar(const std::shared_ptr<Name> &name);
5379  ThreadsafeVar(const ThreadsafeVar &obj);
5380 
5381  virtual ~ThreadsafeVar() = default;
5382 
5383  /// \}
5384 
5385  /**
5386  * \brief Check if the ast node is an instance of ast::ThreadsafeVar
5387  * \return true as object is of type ast::ThreadsafeVar
5388  */
5389  bool is_threadsafe_var() const noexcept override { return true; }
5390 
5391  /**
5392  * \brief Return a copy of the current node
5393  *
5394  * Recursively make a new copy/clone of the current node including
5395  * all members and return a pointer to the node. This is used for
5396  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5397  * ast.
5398  *
5399  * @return pointer to the clone/copy of the current node
5400  */
5401  ThreadsafeVar *clone() const override { return new ThreadsafeVar(*this); }
5402 
5403  /// \name Getters
5404  /// \{
5405 
5406  /**
5407  * \brief Return type (ast::AstNodeType) of ast node
5408  *
5409  * Every node in the ast has a type defined in ast::AstNodeType and this
5410  * function is used to retrieve the same.
5411  *
5412  * \return ast node type i.e. ast::AstNodeType::THREADSAFE_VAR
5413  *
5414  * \sa Ast::get_node_type_name
5415  */
5416  AstNodeType get_node_type() const noexcept override {
5418  }
5419 
5420  /**
5421  * \brief Return type (ast::AstNodeType) of ast node as std::string
5422  *
5423  * Every node in the ast has a type defined in ast::AstNodeType.
5424  * This type name can be returned as a std::string for printing
5425  * node to text/json form.
5426  *
5427  * \return name of the node type as a string i.e. "ThreadsafeVar"
5428  *
5429  * \sa Ast::get_node_name
5430  */
5431  std::string get_node_type_name() const noexcept override {
5432  return "ThreadsafeVar";
5433  }
5434 
5435  /**
5436  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5437  */
5438  std::shared_ptr<Ast> get_shared_ptr() override {
5439  return std::static_pointer_cast<ThreadsafeVar>(shared_from_this());
5440  }
5441 
5442  /**
5443  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5444  */
5445  std::shared_ptr<const Ast> get_shared_ptr() const override {
5446  return std::static_pointer_cast<const ThreadsafeVar>(shared_from_this());
5447  }
5448 
5449  /**
5450  * \brief Return associated token for the current ast node
5451  *
5452  * Not all ast nodes have token information. For example,
5453  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5454  * solution of ODEs. In this case, we return nullptr to store in the
5455  * nmodl::symtab::SymbolTable.
5456  *
5457  * \return pointer to token if exist otherwise nullptr
5458  */
5459  const ModToken *get_token() const noexcept override { return token.get(); }
5460 
5461  /**
5462  * \brief Return name of the node
5463  *
5464  * Some ast nodes have a member marked designated as node name. For example,
5465  * in case of this ast::Name has name designated as a
5466  * node name.
5467  *
5468  * @return name of the node as std::string
5469  *
5470  * \sa Ast::get_node_type_name
5471  */
5472  std::string get_node_name() const override;
5473 
5474  /**
5475  * \brief Getter for member variable \ref ThreadsafeVar.name
5476  */
5477  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
5478 
5479  /// \}
5480 
5481  /// \name Setters
5482  /// \{
5483 
5484  /**
5485  * \brief Set token for the current ast node
5486  */
5487  void set_token(const ModToken &tok) {
5488  token = std::make_shared<ModToken>(tok);
5489  }
5490 
5491  /**
5492  * \brief Setter for member variable \ref ThreadsafeVar.name (rvalue
5493  * reference)
5494  */
5495  void set_name(std::shared_ptr<Name> &&name);
5496 
5497  /**
5498  * \brief Setter for member variable \ref ThreadsafeVar.name
5499  */
5500  void set_name(const std::shared_ptr<Name> &name);
5501 
5502  /// \}
5503 
5504  /// \name Visitor
5505  /// \{
5506 
5507  /**
5508  * \brief visit children i.e. member variables of current node using provided
5509  * visitor
5510  *
5511  * Different nodes in the AST have different members (i.e. children). This
5512  * method recursively visits children using provided visitor.
5513  *
5514  * \param v Concrete visitor that will be used to recursively visit children
5515  *
5516  * \sa Ast::visit_children for example.
5517  */
5518  void visit_children(visitor::Visitor &v) override;
5519 
5520  /**
5521  * \brief accept (or visit) the current AST node using provided visitor
5522  *
5523  * Instead of visiting children of AST node, like Ast::visit_children,
5524  * accept allows to visit the current node itself using provided concrete
5525  * visitor.
5526  *
5527  * \param v Concrete visitor that will be used to recursively visit node
5528  *
5529  * \sa Ast::accept for example.
5530  */
5531  void accept(visitor::Visitor &v) override;
5532 
5533  /// \}
5534 
5535 private:
5536  /**
5537  * \brief Set this object as parent for all the children
5538  *
5539  * This should be called in every object (with children) constructor
5540  * to set parents. Since it is called only in the constructors it
5541  * should not be virtual to avoid ambiguities (issue #295).
5542  */
5543  void set_parent_in_children();
5544 };
5545 
5546 /** @} */ // end of ast_class
5547 
5548 } // namespace ast
5549 } // namespace nmodl
5550 #endif // !NMODL_AST_THREADSAFE_VAR_HPP
5551 #ifndef NMODL_AST_PARAM_BLOCK_HPP
5552 #define NMODL_AST_PARAM_BLOCK_HPP
5553 
5554 namespace nmodl {
5555 namespace ast {
5556 
5557 /**
5558  * @addtogroup ast_class
5559  * @ingroup ast
5560  * @{
5561  */
5562 
5563 /**
5564  * \brief Represents a `PARAMETER` block in the NMODL
5565  *
5566  * Variables whose values are normally specified by the user are parameters
5567  * and are declared in a `PARAMETER` block. Here is an example :
5568  *
5569  * \code{.mod}
5570  * PARAMETER {
5571  * gkbar=.01 (mho/cm2) : Maximum Permeability
5572  * d1 = .84
5573  * k2 = .13e-6 (mM)
5574  * abar = .28 (/ms)
5575  * lcai (mV)
5576  * }
5577  * \endcode
5578  *
5579  * All parameters are stored in the ast::ParamBlock::statements as vector.
5580  *
5581  */
5582 class ParamBlock : public Block {
5583 private:
5584  /// Vector of parameters
5586  /// token with location information
5587  std::shared_ptr<ModToken> token;
5588  /// symbol table for a block
5589  symtab::SymbolTable *symtab = nullptr;
5590 
5591 public:
5592  /// \name Ctor & dtor
5593  /// \{
5594 
5595  explicit ParamBlock(ParamAssignVector statements);
5596  ParamBlock(const ParamBlock &obj);
5597 
5598  virtual ~ParamBlock() = default;
5599 
5600  /// \}
5601 
5602  /**
5603  * \brief Check if the ast node is an instance of ast::ParamBlock
5604  * \return true as object is of type ast::ParamBlock
5605  */
5606  bool is_param_block() const noexcept override { return true; }
5607 
5608  /**
5609  * \brief Return a copy of the current node
5610  *
5611  * Recursively make a new copy/clone of the current node including
5612  * all members and return a pointer to the node. This is used for
5613  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5614  * ast.
5615  *
5616  * @return pointer to the clone/copy of the current node
5617  */
5618  ParamBlock *clone() const override { return new ParamBlock(*this); }
5619 
5620  /// \name Getters
5621  /// \{
5622 
5623  /**
5624  * \brief Return type (ast::AstNodeType) of ast node
5625  *
5626  * Every node in the ast has a type defined in ast::AstNodeType and this
5627  * function is used to retrieve the same.
5628  *
5629  * \return ast node type i.e. ast::AstNodeType::PARAM_BLOCK
5630  *
5631  * \sa Ast::get_node_type_name
5632  */
5633  AstNodeType get_node_type() const noexcept override {
5634  return AstNodeType::PARAM_BLOCK;
5635  }
5636 
5637  /**
5638  * \brief Return type (ast::AstNodeType) of ast node as std::string
5639  *
5640  * Every node in the ast has a type defined in ast::AstNodeType.
5641  * This type name can be returned as a std::string for printing
5642  * node to text/json form.
5643  *
5644  * \return name of the node type as a string i.e. "ParamBlock"
5645  *
5646  * \sa Ast::get_node_name
5647  */
5648  std::string get_node_type_name() const noexcept override {
5649  return "ParamBlock";
5650  }
5651 
5652  /**
5653  * \brief Return NMODL statement of ast node as std::string
5654  *
5655  * Every node is related to a special statement in the NMODL. This
5656  * statement can be returned as a std::string for printing to
5657  * text/json form.
5658  *
5659  * \return name of the statement as a string i.e. "PARAMETER "
5660  *
5661  * \sa Ast::get_nmodl_name
5662  */
5663  std::string get_nmodl_name() const noexcept override { return "PARAMETER "; }
5664 
5665  /**
5666  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5667  */
5668  std::shared_ptr<Ast> get_shared_ptr() override {
5669  return std::static_pointer_cast<ParamBlock>(shared_from_this());
5670  }
5671 
5672  /**
5673  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5674  */
5675  std::shared_ptr<const Ast> get_shared_ptr() const override {
5676  return std::static_pointer_cast<const ParamBlock>(shared_from_this());
5677  }
5678 
5679  /**
5680  * \brief Return associated token for the current ast node
5681  *
5682  * Not all ast nodes have token information. For example,
5683  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5684  * solution of ODEs. In this case, we return nullptr to store in the
5685  * nmodl::symtab::SymbolTable.
5686  *
5687  * \return pointer to token if exist otherwise nullptr
5688  */
5689  const ModToken *get_token() const noexcept override { return token.get(); }
5690 
5691  /**
5692  * \brief Return associated symbol table for the current ast node
5693  *
5694  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
5695  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
5696  * and it can be accessed using this method.
5697  *
5698  * \return pointer to the symbol table
5699  *
5700  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
5701  */
5702  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
5703 
5704  /**
5705  * \brief Getter for member variable \ref ParamBlock.statements
5706  */
5707  const ParamAssignVector &get_statements() const noexcept {
5708  return statements;
5709  }
5710 
5711  /// \}
5712 
5713  /// \name Setters
5714  /// \{
5715 
5716  /**
5717  * \brief Set token for the current ast node
5718  */
5719  void set_token(const ModToken &tok) {
5720  token = std::make_shared<ModToken>(tok);
5721  }
5722 
5723  /**
5724  * \brief Set symbol table for the current ast node
5725  *
5726  * Top level, block scoped nodes store symbol table in the ast node.
5727  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
5728  * for every node in the ast.
5729  *
5730  * \sa nmodl::visitor::SymtabVisitor
5731  */
5732  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
5733  symtab = newsymtab;
5734  }
5735 
5736  /**
5737  * \brief Setter for member variable \ref ParamBlock.statements (rvalue
5738  * reference)
5739  */
5740  void set_statements(ParamAssignVector &&statements);
5741 
5742  /**
5743  * \brief Setter for member variable \ref ParamBlock.statements
5744  */
5745  void set_statements(const ParamAssignVector &statements);
5746 
5747  /// \}
5748 
5749  /// \name Visitor
5750  /// \{
5751 
5752  /**
5753  * \brief visit children i.e. member variables of current node using provided
5754  * visitor
5755  *
5756  * Different nodes in the AST have different members (i.e. children). This
5757  * method recursively visits children using provided visitor.
5758  *
5759  * \param v Concrete visitor that will be used to recursively visit children
5760  *
5761  * \sa Ast::visit_children for example.
5762  */
5763  void visit_children(visitor::Visitor &v) override;
5764 
5765  /**
5766  * \brief accept (or visit) the current AST node using provided visitor
5767  *
5768  * Instead of visiting children of AST node, like Ast::visit_children,
5769  * accept allows to visit the current node itself using provided concrete
5770  * visitor.
5771  *
5772  * \param v Concrete visitor that will be used to recursively visit node
5773  *
5774  * \sa Ast::accept for example.
5775  */
5776  void accept(visitor::Visitor &v) override;
5777 
5778  /// \}
5779 
5780 private:
5781  /**
5782  * \brief Set this object as parent for all the children
5783  *
5784  * This should be called in every object (with children) constructor
5785  * to set parents. Since it is called only in the constructors it
5786  * should not be virtual to avoid ambiguities (issue #295).
5787  */
5788  void set_parent_in_children();
5789 };
5790 
5791 /** @} */ // end of ast_class
5792 
5793 } // namespace ast
5794 } // namespace nmodl
5795 #endif // !NMODL_AST_PARAM_BLOCK_HPP
5796 #ifndef NMODL_AST_STEP_BLOCK_HPP
5797 #define NMODL_AST_STEP_BLOCK_HPP
5798 
5799 namespace nmodl {
5800 namespace ast {
5801 
5802 /**
5803  * @addtogroup ast_class
5804  * @ingroup ast
5805  * @{
5806  */
5807 
5808 /**
5809  * \brief Represents a `STEPPED` block in the NMODL
5810  *
5811  * `STEPPED` has following form in the NMODL specification :
5812  *
5813  * \code{.mod}
5814  * STEPPED {
5815  * name1 = number1 (mM)
5816  * name2 = number2, number3
5817  * }
5818  * \endcode
5819  *
5820  * \todo Check ModelDB and other databse for example of channel.
5821  *
5822  */
5823 class StepBlock : public Block {
5824 private:
5825  /// Vector of statements
5827  /// token with location information
5828  std::shared_ptr<ModToken> token;
5829  /// symbol table for a block
5830  symtab::SymbolTable *symtab = nullptr;
5831 
5832 public:
5833  /// \name Ctor & dtor
5834  /// \{
5835 
5836  explicit StepBlock(SteppedVector statements);
5837  StepBlock(const StepBlock &obj);
5838 
5839  virtual ~StepBlock() = default;
5840 
5841  /// \}
5842 
5843  /**
5844  * \brief Check if the ast node is an instance of ast::StepBlock
5845  * \return true as object is of type ast::StepBlock
5846  */
5847  bool is_step_block() const noexcept override { return true; }
5848 
5849  /**
5850  * \brief Return a copy of the current node
5851  *
5852  * Recursively make a new copy/clone of the current node including
5853  * all members and return a pointer to the node. This is used for
5854  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5855  * ast.
5856  *
5857  * @return pointer to the clone/copy of the current node
5858  */
5859  StepBlock *clone() const override { return new StepBlock(*this); }
5860 
5861  /// \name Getters
5862  /// \{
5863 
5864  /**
5865  * \brief Return type (ast::AstNodeType) of ast node
5866  *
5867  * Every node in the ast has a type defined in ast::AstNodeType and this
5868  * function is used to retrieve the same.
5869  *
5870  * \return ast node type i.e. ast::AstNodeType::STEP_BLOCK
5871  *
5872  * \sa Ast::get_node_type_name
5873  */
5874  AstNodeType get_node_type() const noexcept override {
5875  return AstNodeType::STEP_BLOCK;
5876  }
5877 
5878  /**
5879  * \brief Return type (ast::AstNodeType) of ast node as std::string
5880  *
5881  * Every node in the ast has a type defined in ast::AstNodeType.
5882  * This type name can be returned as a std::string for printing
5883  * node to text/json form.
5884  *
5885  * \return name of the node type as a string i.e. "StepBlock"
5886  *
5887  * \sa Ast::get_node_name
5888  */
5889  std::string get_node_type_name() const noexcept override {
5890  return "StepBlock";
5891  }
5892 
5893  /**
5894  * \brief Return NMODL statement of ast node as std::string
5895  *
5896  * Every node is related to a special statement in the NMODL. This
5897  * statement can be returned as a std::string for printing to
5898  * text/json form.
5899  *
5900  * \return name of the statement as a string i.e. "STEPPED "
5901  *
5902  * \sa Ast::get_nmodl_name
5903  */
5904  std::string get_nmodl_name() const noexcept override { return "STEPPED "; }
5905 
5906  /**
5907  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5908  */
5909  std::shared_ptr<Ast> get_shared_ptr() override {
5910  return std::static_pointer_cast<StepBlock>(shared_from_this());
5911  }
5912 
5913  /**
5914  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5915  */
5916  std::shared_ptr<const Ast> get_shared_ptr() const override {
5917  return std::static_pointer_cast<const StepBlock>(shared_from_this());
5918  }
5919 
5920  /**
5921  * \brief Return associated token for the current ast node
5922  *
5923  * Not all ast nodes have token information. For example,
5924  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5925  * solution of ODEs. In this case, we return nullptr to store in the
5926  * nmodl::symtab::SymbolTable.
5927  *
5928  * \return pointer to token if exist otherwise nullptr
5929  */
5930  const ModToken *get_token() const noexcept override { return token.get(); }
5931 
5932  /**
5933  * \brief Return associated symbol table for the current ast node
5934  *
5935  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
5936  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
5937  * and it can be accessed using this method.
5938  *
5939  * \return pointer to the symbol table
5940  *
5941  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
5942  */
5943  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
5944 
5945  /**
5946  * \brief Getter for member variable \ref StepBlock.statements
5947  */
5948  const SteppedVector &get_statements() const noexcept { return statements; }
5949 
5950  /// \}
5951 
5952  /// \name Setters
5953  /// \{
5954 
5955  /**
5956  * \brief Set token for the current ast node
5957  */
5958  void set_token(const ModToken &tok) {
5959  token = std::make_shared<ModToken>(tok);
5960  }
5961 
5962  /**
5963  * \brief Set symbol table for the current ast node
5964  *
5965  * Top level, block scoped nodes store symbol table in the ast node.
5966  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
5967  * for every node in the ast.
5968  *
5969  * \sa nmodl::visitor::SymtabVisitor
5970  */
5971  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
5972  symtab = newsymtab;
5973  }
5974 
5975  /**
5976  * \brief Setter for member variable \ref StepBlock.statements (rvalue
5977  * reference)
5978  */
5979  void set_statements(SteppedVector &&statements);
5980 
5981  /**
5982  * \brief Setter for member variable \ref StepBlock.statements
5983  */
5984  void set_statements(const SteppedVector &statements);
5985 
5986  /// \}
5987 
5988  /// \name Visitor
5989  /// \{
5990 
5991  /**
5992  * \brief visit children i.e. member variables of current node using provided
5993  * visitor
5994  *
5995  * Different nodes in the AST have different members (i.e. children). This
5996  * method recursively visits children using provided visitor.
5997  *
5998  * \param v Concrete visitor that will be used to recursively visit children
5999  *
6000  * \sa Ast::visit_children for example.
6001  */
6002  void visit_children(visitor::Visitor &v) override;
6003 
6004  /**
6005  * \brief accept (or visit) the current AST node using provided visitor
6006  *
6007  * Instead of visiting children of AST node, like Ast::visit_children,
6008  * accept allows to visit the current node itself using provided concrete
6009  * visitor.
6010  *
6011  * \param v Concrete visitor that will be used to recursively visit node
6012  *
6013  * \sa Ast::accept for example.
6014  */
6015  void accept(visitor::Visitor &v) override;
6016 
6017  /// \}
6018 
6019 private:
6020  /**
6021  * \brief Set this object as parent for all the children
6022  *
6023  * This should be called in every object (with children) constructor
6024  * to set parents. Since it is called only in the constructors it
6025  * should not be virtual to avoid ambiguities (issue #295).
6026  */
6027  void set_parent_in_children();
6028 };
6029 
6030 /** @} */ // end of ast_class
6031 
6032 } // namespace ast
6033 } // namespace nmodl
6034 #endif // !NMODL_AST_STEP_BLOCK_HPP
6035 #ifndef NMODL_AST_INDEPENDENT_BLOCK_HPP
6036 #define NMODL_AST_INDEPENDENT_BLOCK_HPP
6037 
6038 namespace nmodl {
6039 namespace ast {
6040 
6041 /**
6042  * @addtogroup ast_class
6043  * @ingroup ast
6044  * @{
6045  */
6046 
6047 /**
6048  * \brief Represents a `INDEPENDENT` block in the NMODL
6049  *
6050  * `INDEPENDENT` has following form in the NMODL specification :
6051  *
6052  * \code{.mod}
6053  * INDEPENDENT {
6054  * t FROM 0 TO 1 WITH 1 (ms)
6055  * }
6056  * \endcode
6057  *
6058  */
6059 class IndependentBlock : public Block {
6060 private:
6061  /// TODO
6063  /// token with location information
6064  std::shared_ptr<ModToken> token;
6065  /// symbol table for a block
6066  symtab::SymbolTable *symtab = nullptr;
6067 
6068 public:
6069  /// \name Ctor & dtor
6070  /// \{
6071 
6072  explicit IndependentBlock(IndependentDefinitionVector definitions);
6073  IndependentBlock(const IndependentBlock &obj);
6074 
6075  virtual ~IndependentBlock() = default;
6076 
6077  /// \}
6078 
6079  /**
6080  * \brief Check if the ast node is an instance of ast::IndependentBlock
6081  * \return true as object is of type ast::IndependentBlock
6082  */
6083  bool is_independent_block() const noexcept override { return true; }
6084 
6085  /**
6086  * \brief Return a copy of the current node
6087  *
6088  * Recursively make a new copy/clone of the current node including
6089  * all members and return a pointer to the node. This is used for
6090  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6091  * ast.
6092  *
6093  * @return pointer to the clone/copy of the current node
6094  */
6095  IndependentBlock *clone() const override {
6096  return new IndependentBlock(*this);
6097  }
6098 
6099  /// \name Getters
6100  /// \{
6101 
6102  /**
6103  * \brief Return type (ast::AstNodeType) of ast node
6104  *
6105  * Every node in the ast has a type defined in ast::AstNodeType and this
6106  * function is used to retrieve the same.
6107  *
6108  * \return ast node type i.e. ast::AstNodeType::INDEPENDENT_BLOCK
6109  *
6110  * \sa Ast::get_node_type_name
6111  */
6112  AstNodeType get_node_type() const noexcept override {
6114  }
6115 
6116  /**
6117  * \brief Return type (ast::AstNodeType) of ast node as std::string
6118  *
6119  * Every node in the ast has a type defined in ast::AstNodeType.
6120  * This type name can be returned as a std::string for printing
6121  * node to text/json form.
6122  *
6123  * \return name of the node type as a string i.e. "IndependentBlock"
6124  *
6125  * \sa Ast::get_node_name
6126  */
6127  std::string get_node_type_name() const noexcept override {
6128  return "IndependentBlock";
6129  }
6130 
6131  /**
6132  * \brief Return NMODL statement of ast node as std::string
6133  *
6134  * Every node is related to a special statement in the NMODL. This
6135  * statement can be returned as a std::string for printing to
6136  * text/json form.
6137  *
6138  * \return name of the statement as a string i.e. "INDEPENDENT "
6139  *
6140  * \sa Ast::get_nmodl_name
6141  */
6142  std::string get_nmodl_name() const noexcept override {
6143  return "INDEPENDENT ";
6144  }
6145 
6146  /**
6147  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6148  */
6149  std::shared_ptr<Ast> get_shared_ptr() override {
6150  return std::static_pointer_cast<IndependentBlock>(shared_from_this());
6151  }
6152 
6153  /**
6154  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6155  */
6156  std::shared_ptr<const Ast> get_shared_ptr() const override {
6157  return std::static_pointer_cast<const IndependentBlock>(shared_from_this());
6158  }
6159 
6160  /**
6161  * \brief Return associated token for the current ast node
6162  *
6163  * Not all ast nodes have token information. For example,
6164  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
6165  * solution of ODEs. In this case, we return nullptr to store in the
6166  * nmodl::symtab::SymbolTable.
6167  *
6168  * \return pointer to token if exist otherwise nullptr
6169  */
6170  const ModToken *get_token() const noexcept override { return token.get(); }
6171 
6172  /**
6173  * \brief Return associated symbol table for the current ast node
6174  *
6175  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
6176  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
6177  * and it can be accessed using this method.
6178  *
6179  * \return pointer to the symbol table
6180  *
6181  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
6182  */
6183  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
6184 
6185  /**
6186  * \brief Getter for member variable \ref IndependentBlock.definitions
6187  */
6189  return definitions;
6190  }
6191 
6192  /// \}
6193 
6194  /// \name Setters
6195  /// \{
6196 
6197  /**
6198  * \brief Set token for the current ast node
6199  */
6200  void set_token(const ModToken &tok) {
6201  token = std::make_shared<ModToken>(tok);
6202  }
6203 
6204  /**
6205  * \brief Set symbol table for the current ast node
6206  *
6207  * Top level, block scoped nodes store symbol table in the ast node.
6208  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
6209  * for every node in the ast.
6210  *
6211  * \sa nmodl::visitor::SymtabVisitor
6212  */
6213  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
6214  symtab = newsymtab;
6215  }
6216 
6217  /**
6218  * \brief Setter for member variable \ref IndependentBlock.definitions (rvalue
6219  * reference)
6220  */
6221  void set_definitions(IndependentDefinitionVector &&definitions);
6222 
6223  /**
6224  * \brief Setter for member variable \ref IndependentBlock.definitions
6225  */
6226  void set_definitions(const IndependentDefinitionVector &definitions);
6227 
6228  /// \}
6229 
6230  /// \name Visitor
6231  /// \{
6232 
6233  /**
6234  * \brief visit children i.e. member variables of current node using provided
6235  * visitor
6236  *
6237  * Different nodes in the AST have different members (i.e. children). This
6238  * method recursively visits children using provided visitor.
6239  *
6240  * \param v Concrete visitor that will be used to recursively visit children
6241  *
6242  * \sa Ast::visit_children for example.
6243  */
6244  void visit_children(visitor::Visitor &v) override;
6245 
6246  /**
6247  * \brief accept (or visit) the current AST node using provided visitor
6248  *
6249  * Instead of visiting children of AST node, like Ast::visit_children,
6250  * accept allows to visit the current node itself using provided concrete
6251  * visitor.
6252  *
6253  * \param v Concrete visitor that will be used to recursively visit node
6254  *
6255  * \sa Ast::accept for example.
6256  */
6257  void accept(visitor::Visitor &v) override;
6258 
6259  /// \}
6260 
6261 private:
6262  /**
6263  * \brief Set this object as parent for all the children
6264  *
6265  * This should be called in every object (with children) constructor
6266  * to set parents. Since it is called only in the constructors it
6267  * should not be virtual to avoid ambiguities (issue #295).
6268  */
6269  void set_parent_in_children();
6270 };
6271 
6272 /** @} */ // end of ast_class
6273 
6274 } // namespace ast
6275 } // namespace nmodl
6276 #endif // !NMODL_AST_INDEPENDENT_BLOCK_HPP
6277 #ifndef NMODL_AST_ASSIGNED_BLOCK_HPP
6278 #define NMODL_AST_ASSIGNED_BLOCK_HPP
6279 
6280 namespace nmodl {
6281 namespace ast {
6282 
6283 /**
6284  * @addtogroup ast_class
6285  * @ingroup ast
6286  * @{
6287  */
6288 
6289 /**
6290  * \brief Represents a `ASSIGNED` block in the NMODL
6291  *
6292  * The `ASSIGNED` block is used for declaring two kinds of variables :
6293  * - those that are given values outside the mod files
6294  * - those that appear on the left hand side of assignment statements within
6295  * the mod file
6296  *
6297  * Below is an example of `ASSIGNED` block in the mod file:
6298  *
6299  * \code{.mod}
6300  * ASSIGNED {
6301  * ina (mA/cm2)
6302  * gna (pS/um2)
6303  * mtau (ms) htau (ms)
6304  * tadj
6305  * }
6306  * \endcode
6307  *
6308  */
6309 class AssignedBlock : public Block {
6310 private:
6311  /// Vector of assigned variables
6313  /// token with location information
6314  std::shared_ptr<ModToken> token;
6315  /// symbol table for a block
6316  symtab::SymbolTable *symtab = nullptr;
6317 
6318 public:
6319  /// \name Ctor & dtor
6320  /// \{
6321 
6322  explicit AssignedBlock(AssignedDefinitionVector definitions);
6323  AssignedBlock(const AssignedBlock &obj);
6324 
6325  virtual ~AssignedBlock() = default;
6326 
6327  /// \}
6328 
6329  /**
6330  * \brief Check if the ast node is an instance of ast::AssignedBlock
6331  * \return true as object is of type ast::AssignedBlock
6332  */
6333  bool is_assigned_block() const noexcept override { return true; }
6334 
6335  /**
6336  * \brief Return a copy of the current node
6337  *
6338  * Recursively make a new copy/clone of the current node including
6339  * all members and return a pointer to the node. This is used for
6340  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6341  * ast.
6342  *
6343  * @return pointer to the clone/copy of the current node
6344  */
6345  AssignedBlock *clone() const override { return new AssignedBlock(*this); }
6346 
6347  /// \name Getters
6348  /// \{
6349 
6350  /**
6351  * \brief Return type (ast::AstNodeType) of ast node
6352  *
6353  * Every node in the ast has a type defined in ast::AstNodeType and this
6354  * function is used to retrieve the same.
6355  *
6356  * \return ast node type i.e. ast::AstNodeType::ASSIGNED_BLOCK
6357  *
6358  * \sa Ast::get_node_type_name
6359  */
6360  AstNodeType get_node_type() const noexcept override {
6362  }
6363 
6364  /**
6365  * \brief Return type (ast::AstNodeType) of ast node as std::string
6366  *
6367  * Every node in the ast has a type defined in ast::AstNodeType.
6368  * This type name can be returned as a std::string for printing
6369  * node to text/json form.
6370  *
6371  * \return name of the node type as a string i.e. "AssignedBlock"
6372  *
6373  * \sa Ast::get_node_name
6374  */
6375  std::string get_node_type_name() const noexcept override {
6376  return "AssignedBlock";
6377  }
6378 
6379  /**
6380  * \brief Return NMODL statement of ast node as std::string
6381  *
6382  * Every node is related to a special statement in the NMODL. This
6383  * statement can be returned as a std::string for printing to
6384  * text/json form.
6385  *
6386  * \return name of the statement as a string i.e. "ASSIGNED "
6387  *
6388  * \sa Ast::get_nmodl_name
6389  */
6390  std::string get_nmodl_name() const noexcept override { return "ASSIGNED "; }
6391 
6392  /**
6393  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6394  */
6395  std::shared_ptr<Ast> get_shared_ptr() override {
6396  return std::static_pointer_cast<AssignedBlock>(shared_from_this());
6397  }
6398 
6399  /**
6400  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6401  */
6402  std::shared_ptr<const Ast> get_shared_ptr() const override {
6403  return std::static_pointer_cast<const AssignedBlock>(shared_from_this());
6404  }
6405 
6406  /**
6407  * \brief Return associated token for the current ast node
6408  *
6409  * Not all ast nodes have token information. For example,
6410  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
6411  * solution of ODEs. In this case, we return nullptr to store in the
6412  * nmodl::symtab::SymbolTable.
6413  *
6414  * \return pointer to token if exist otherwise nullptr
6415  */
6416  const ModToken *get_token() const noexcept override { return token.get(); }
6417 
6418  /**
6419  * \brief Return associated symbol table for the current ast node
6420  *
6421  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
6422  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
6423  * and it can be accessed using this method.
6424  *
6425  * \return pointer to the symbol table
6426  *
6427  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
6428  */
6429  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
6430 
6431  /**
6432  * \brief Getter for member variable \ref AssignedBlock.definitions
6433  */
6434  const AssignedDefinitionVector &get_definitions() const noexcept {
6435  return definitions;
6436  }
6437 
6438  /// \}
6439 
6440  /// \name Setters
6441  /// \{
6442 
6443  /**
6444  * \brief Set token for the current ast node
6445  */
6446  void set_token(const ModToken &tok) {
6447  token = std::make_shared<ModToken>(tok);
6448  }
6449 
6450  /**
6451  * \brief Set symbol table for the current ast node
6452  *
6453  * Top level, block scoped nodes store symbol table in the ast node.
6454  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
6455  * for every node in the ast.
6456  *
6457  * \sa nmodl::visitor::SymtabVisitor
6458  */
6459  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
6460  symtab = newsymtab;
6461  }
6462 
6463  /**
6464  * \brief Setter for member variable \ref AssignedBlock.definitions (rvalue
6465  * reference)
6466  */
6467  void set_definitions(AssignedDefinitionVector &&definitions);
6468 
6469  /**
6470  * \brief Setter for member variable \ref AssignedBlock.definitions
6471  */
6472  void set_definitions(const AssignedDefinitionVector &definitions);
6473 
6474  /// \}
6475 
6476  /// \name Visitor
6477  /// \{
6478 
6479  /**
6480  * \brief visit children i.e. member variables of current node using provided
6481  * visitor
6482  *
6483  * Different nodes in the AST have different members (i.e. children). This
6484  * method recursively visits children using provided visitor.
6485  *
6486  * \param v Concrete visitor that will be used to recursively visit children
6487  *
6488  * \sa Ast::visit_children for example.
6489  */
6490  void visit_children(visitor::Visitor &v) override;
6491 
6492  /**
6493  * \brief accept (or visit) the current AST node using provided visitor
6494  *
6495  * Instead of visiting children of AST node, like Ast::visit_children,
6496  * accept allows to visit the current node itself using provided concrete
6497  * visitor.
6498  *
6499  * \param v Concrete visitor that will be used to recursively visit node
6500  *
6501  * \sa Ast::accept for example.
6502  */
6503  void accept(visitor::Visitor &v) override;
6504 
6505  /// \}
6506 
6507 private:
6508  /**
6509  * \brief Set this object as parent for all the children
6510  *
6511  * This should be called in every object (with children) constructor
6512  * to set parents. Since it is called only in the constructors it
6513  * should not be virtual to avoid ambiguities (issue #295).
6514  */
6515  void set_parent_in_children();
6516 };
6517 
6518 /** @} */ // end of ast_class
6519 
6520 } // namespace ast
6521 } // namespace nmodl
6522 #endif // !NMODL_AST_ASSIGNED_BLOCK_HPP
6523 #ifndef NMODL_AST_STATE_BLOCK_HPP
6524 #define NMODL_AST_STATE_BLOCK_HPP
6525 
6526 namespace nmodl {
6527 namespace ast {
6528 
6529 /**
6530  * @addtogroup ast_class
6531  * @ingroup ast
6532  * @{
6533  */
6534 
6535 /**
6536  * \brief Represents a `STATE` block in the NMODL
6537  *
6538  * If a model involves differential equations, families of algebraic equations,
6539  * or kinetic reaction schemes, their dependent variables or unknowns are to be
6540  * listed in the `STATE` block. Below is an example of `STATE`:
6541  *
6542  * \code{.mod}
6543  * STATE {
6544  * m
6545  * h
6546  * }
6547  * \endcode
6548  *
6549  * Note that the state variable specification has form of
6550  * ast::AssignedDefinition and hence can have associated unit specification.
6551  *
6552  */
6553 class StateBlock : public Block {
6554 private:
6555  /// Vector of state variables
6557  /// token with location information
6558  std::shared_ptr<ModToken> token;
6559  /// symbol table for a block
6560  symtab::SymbolTable *symtab = nullptr;
6561 
6562 public:
6563  /// \name Ctor & dtor
6564  /// \{
6565 
6566  explicit StateBlock(AssignedDefinitionVector definitions);
6567  StateBlock(const StateBlock &obj);
6568 
6569  virtual ~StateBlock() = default;
6570 
6571  /// \}
6572 
6573  /**
6574  * \brief Check if the ast node is an instance of ast::StateBlock
6575  * \return true as object is of type ast::StateBlock
6576  */
6577  bool is_state_block() const noexcept override { return true; }
6578 
6579  /**
6580  * \brief Return a copy of the current node
6581  *
6582  * Recursively make a new copy/clone of the current node including
6583  * all members and return a pointer to the node. This is used for
6584  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6585  * ast.
6586  *
6587  * @return pointer to the clone/copy of the current node
6588  */
6589  StateBlock *clone() const override { return new StateBlock(*this); }
6590 
6591  /// \name Getters
6592  /// \{
6593 
6594  /**
6595  * \brief Return type (ast::AstNodeType) of ast node
6596  *
6597  * Every node in the ast has a type defined in ast::AstNodeType and this
6598  * function is used to retrieve the same.
6599  *
6600  * \return ast node type i.e. ast::AstNodeType::STATE_BLOCK
6601  *
6602  * \sa Ast::get_node_type_name
6603  */
6604  AstNodeType get_node_type() const noexcept override {
6605  return AstNodeType::STATE_BLOCK;
6606  }
6607 
6608  /**
6609  * \brief Return type (ast::AstNodeType) of ast node as std::string
6610  *
6611  * Every node in the ast has a type defined in ast::AstNodeType.
6612  * This type name can be returned as a std::string for printing
6613  * node to text/json form.
6614  *
6615  * \return name of the node type as a string i.e. "StateBlock"
6616  *
6617  * \sa Ast::get_node_name
6618  */
6619  std::string get_node_type_name() const noexcept override {
6620  return "StateBlock";
6621  }
6622 
6623  /**
6624  * \brief Return NMODL statement of ast node as std::string
6625  *
6626  * Every node is related to a special statement in the NMODL. This
6627  * statement can be returned as a std::string for printing to
6628  * text/json form.
6629  *
6630  * \return name of the statement as a string i.e. "STATE "
6631  *
6632  * \sa Ast::get_nmodl_name
6633  */
6634  std::string get_nmodl_name() const noexcept override { return "STATE "; }
6635 
6636  /**
6637  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6638  */
6639  std::shared_ptr<Ast> get_shared_ptr() override {
6640  return std::static_pointer_cast<StateBlock>(shared_from_this());
6641  }
6642 
6643  /**
6644  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6645  */
6646  std::shared_ptr<const Ast> get_shared_ptr() const override {
6647  return std::static_pointer_cast<const StateBlock>(shared_from_this());
6648  }
6649 
6650  /**
6651  * \brief Return associated token for the current ast node
6652  *
6653  * Not all ast nodes have token information. For example,
6654  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
6655  * solution of ODEs. In this case, we return nullptr to store in the
6656  * nmodl::symtab::SymbolTable.
6657  *
6658  * \return pointer to token if exist otherwise nullptr
6659  */
6660  const ModToken *get_token() const noexcept override { return token.get(); }
6661 
6662  /**
6663  * \brief Return associated symbol table for the current ast node
6664  *
6665  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
6666  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
6667  * and it can be accessed using this method.
6668  *
6669  * \return pointer to the symbol table
6670  *
6671  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
6672  */
6673  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
6674 
6675  /**
6676  * \brief Getter for member variable \ref StateBlock.definitions
6677  */
6678  const AssignedDefinitionVector &get_definitions() const noexcept {
6679  return definitions;
6680  }
6681 
6682  /// \}
6683 
6684  /// \name Setters
6685  /// \{
6686 
6687  /**
6688  * \brief Set token for the current ast node
6689  */
6690  void set_token(const ModToken &tok) {
6691  token = std::make_shared<ModToken>(tok);
6692  }
6693 
6694  /**
6695  * \brief Set symbol table for the current ast node
6696  *
6697  * Top level, block scoped nodes store symbol table in the ast node.
6698  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
6699  * for every node in the ast.
6700  *
6701  * \sa nmodl::visitor::SymtabVisitor
6702  */
6703  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
6704  symtab = newsymtab;
6705  }
6706 
6707  /**
6708  * \brief Setter for member variable \ref StateBlock.definitions (rvalue
6709  * reference)
6710  */
6711  void set_definitions(AssignedDefinitionVector &&definitions);
6712 
6713  /**
6714  * \brief Setter for member variable \ref StateBlock.definitions
6715  */
6716  void set_definitions(const AssignedDefinitionVector &definitions);
6717 
6718  /// \}
6719 
6720  /// \name Visitor
6721  /// \{
6722 
6723  /**
6724  * \brief visit children i.e. member variables of current node using provided
6725  * visitor
6726  *
6727  * Different nodes in the AST have different members (i.e. children). This
6728  * method recursively visits children using provided visitor.
6729  *
6730  * \param v Concrete visitor that will be used to recursively visit children
6731  *
6732  * \sa Ast::visit_children for example.
6733  */
6734  void visit_children(visitor::Visitor &v) override;
6735 
6736  /**
6737  * \brief accept (or visit) the current AST node using provided visitor
6738  *
6739  * Instead of visiting children of AST node, like Ast::visit_children,
6740  * accept allows to visit the current node itself using provided concrete
6741  * visitor.
6742  *
6743  * \param v Concrete visitor that will be used to recursively visit node
6744  *
6745  * \sa Ast::accept for example.
6746  */
6747  void accept(visitor::Visitor &v) override;
6748 
6749  /// \}
6750 
6751 private:
6752  /**
6753  * \brief Set this object as parent for all the children
6754  *
6755  * This should be called in every object (with children) constructor
6756  * to set parents. Since it is called only in the constructors it
6757  * should not be virtual to avoid ambiguities (issue #295).
6758  */
6759  void set_parent_in_children();
6760 };
6761 
6762 /** @} */ // end of ast_class
6763 
6764 } // namespace ast
6765 } // namespace nmodl
6766 #endif // !NMODL_AST_STATE_BLOCK_HPP
6767 #ifndef NMODL_AST_PLOT_BLOCK_HPP
6768 #define NMODL_AST_PLOT_BLOCK_HPP
6769 
6770 namespace nmodl {
6771 namespace ast {
6772 
6773 /**
6774  * @addtogroup ast_class
6775  * @ingroup ast
6776  * @{
6777  */
6778 
6779 /**
6780  * \brief Represents a `PLOT` statement in the NMODL
6781  *
6782  * `PLOT` construct doesn't have block scope but it's standalone, global scoped
6783  * statement of the form:
6784  *
6785  * \code{.mod}
6786  * PLOT name1, index_var2 VS name3
6787  * \endcode
6788  *
6789  * \todo Check ModelDB and other databse for example of channel.
6790  *
6791  */
6792 class PlotBlock : public Block {
6793 private:
6794  /// Vector of plot variables
6795  std::shared_ptr<PlotDeclaration> plot;
6796  /// token with location information
6797  std::shared_ptr<ModToken> token;
6798  /// symbol table for a block
6799  symtab::SymbolTable *symtab = nullptr;
6800 
6801 public:
6802  /// \name Ctor & dtor
6803  /// \{
6804 
6805  explicit PlotBlock(PlotDeclaration *plot);
6806  explicit PlotBlock(const std::shared_ptr<PlotDeclaration> &plot);
6807  PlotBlock(const PlotBlock &obj);
6808 
6809  virtual ~PlotBlock() = default;
6810 
6811  /// \}
6812 
6813  /**
6814  * \brief Check if the ast node is an instance of ast::PlotBlock
6815  * \return true as object is of type ast::PlotBlock
6816  */
6817  bool is_plot_block() const noexcept override { return true; }
6818 
6819  /**
6820  * \brief Return a copy of the current node
6821  *
6822  * Recursively make a new copy/clone of the current node including
6823  * all members and return a pointer to the node. This is used for
6824  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6825  * ast.
6826  *
6827  * @return pointer to the clone/copy of the current node
6828  */
6829  PlotBlock *clone() const override { return new PlotBlock(*this); }
6830 
6831  /// \name Getters
6832  /// \{
6833 
6834  /**
6835  * \brief Return type (ast::AstNodeType) of ast node
6836  *
6837  * Every node in the ast has a type defined in ast::AstNodeType and this
6838  * function is used to retrieve the same.
6839  *
6840  * \return ast node type i.e. ast::AstNodeType::PLOT_BLOCK
6841  *
6842  * \sa Ast::get_node_type_name
6843  */
6844  AstNodeType get_node_type() const noexcept override {
6845  return AstNodeType::PLOT_BLOCK;
6846  }
6847 
6848  /**
6849  * \brief Return type (ast::AstNodeType) of ast node as std::string
6850  *
6851  * Every node in the ast has a type defined in ast::AstNodeType.
6852  * This type name can be returned as a std::string for printing
6853  * node to text/json form.
6854  *
6855  * \return name of the node type as a string i.e. "PlotBlock"
6856  *
6857  * \sa Ast::get_node_name
6858  */
6859  std::string get_node_type_name() const noexcept override {
6860  return "PlotBlock";
6861  }
6862 
6863  /**
6864  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6865  */
6866  std::shared_ptr<Ast> get_shared_ptr() override {
6867  return std::static_pointer_cast<PlotBlock>(shared_from_this());
6868  }
6869 
6870  /**
6871  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6872  */
6873  std::shared_ptr<const Ast> get_shared_ptr() const override {
6874  return std::static_pointer_cast<const PlotBlock>(shared_from_this());
6875  }
6876 
6877  /**
6878  * \brief Return associated token for the current ast node
6879  *
6880  * Not all ast nodes have token information. For example,
6881  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
6882  * solution of ODEs. In this case, we return nullptr to store in the
6883  * nmodl::symtab::SymbolTable.
6884  *
6885  * \return pointer to token if exist otherwise nullptr
6886  */
6887  const ModToken *get_token() const noexcept override { return token.get(); }
6888 
6889  /**
6890  * \brief Return associated symbol table for the current ast node
6891  *
6892  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
6893  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
6894  * and it can be accessed using this method.
6895  *
6896  * \return pointer to the symbol table
6897  *
6898  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
6899  */
6900  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
6901 
6902  /**
6903  * \brief Getter for member variable \ref PlotBlock.plot
6904  */
6905  const std::shared_ptr<PlotDeclaration> &get_plot() const noexcept {
6906  return plot;
6907  }
6908 
6909  /// \}
6910 
6911  /// \name Setters
6912  /// \{
6913 
6914  /**
6915  * \brief Set token for the current ast node
6916  */
6917  void set_token(const ModToken &tok) {
6918  token = std::make_shared<ModToken>(tok);
6919  }
6920 
6921  /**
6922  * \brief Set symbol table for the current ast node
6923  *
6924  * Top level, block scoped nodes store symbol table in the ast node.
6925  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
6926  * for every node in the ast.
6927  *
6928  * \sa nmodl::visitor::SymtabVisitor
6929  */
6930  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
6931  symtab = newsymtab;
6932  }
6933 
6934  /**
6935  * \brief Setter for member variable \ref PlotBlock.plot (rvalue reference)
6936  */
6937  void set_plot(std::shared_ptr<PlotDeclaration> &&plot);
6938 
6939  /**
6940  * \brief Setter for member variable \ref PlotBlock.plot
6941  */
6942  void set_plot(const std::shared_ptr<PlotDeclaration> &plot);
6943 
6944  /// \}
6945 
6946  /// \name Visitor
6947  /// \{
6948 
6949  /**
6950  * \brief visit children i.e. member variables of current node using provided
6951  * visitor
6952  *
6953  * Different nodes in the AST have different members (i.e. children). This
6954  * method recursively visits children using provided visitor.
6955  *
6956  * \param v Concrete visitor that will be used to recursively visit children
6957  *
6958  * \sa Ast::visit_children for example.
6959  */
6960  void visit_children(visitor::Visitor &v) override;
6961 
6962  /**
6963  * \brief accept (or visit) the current AST node using provided visitor
6964  *
6965  * Instead of visiting children of AST node, like Ast::visit_children,
6966  * accept allows to visit the current node itself using provided concrete
6967  * visitor.
6968  *
6969  * \param v Concrete visitor that will be used to recursively visit node
6970  *
6971  * \sa Ast::accept for example.
6972  */
6973  void accept(visitor::Visitor &v) override;
6974 
6975  /// \}
6976 
6977 private:
6978  /**
6979  * \brief Set this object as parent for all the children
6980  *
6981  * This should be called in every object (with children) constructor
6982  * to set parents. Since it is called only in the constructors it
6983  * should not be virtual to avoid ambiguities (issue #295).
6984  */
6985  void set_parent_in_children();
6986 };
6987 
6988 /** @} */ // end of ast_class
6989 
6990 } // namespace ast
6991 } // namespace nmodl
6992 #endif // !NMODL_AST_PLOT_BLOCK_HPP
6993 #ifndef NMODL_AST_INITIAL_BLOCK_HPP
6994 #define NMODL_AST_INITIAL_BLOCK_HPP
6995 
6996 namespace nmodl {
6997 namespace ast {
6998 
6999 /**
7000  * @addtogroup ast_class
7001  * @ingroup ast
7002  * @{
7003  */
7004 
7005 /**
7006  * \brief Represents a `INITIAL` block in the NMODL
7007  *
7008  * The code in the `INITIAL` block is executed when the hoc function
7009  * `finitialize()` is called. Here is an example :
7010  *
7011  * \code{.mod}
7012  * INITIAL {
7013  * rates(v+vshift)
7014  * m = minf
7015  * h = hinf
7016  * tadj = q10^((celsius - temp)/10)
7017  * }
7018  * \endcode
7019  *
7020  */
7021 class InitialBlock : public Block {
7022 private:
7023  /// Block with statements vector
7024  std::shared_ptr<StatementBlock> statement_block;
7025  /// token with location information
7026  std::shared_ptr<ModToken> token;
7027  /// symbol table for a block
7028  symtab::SymbolTable *symtab = nullptr;
7029 
7030 public:
7031  /// \name Ctor & dtor
7032  /// \{
7033 
7034  explicit InitialBlock(StatementBlock *statement_block);
7035  explicit InitialBlock(const std::shared_ptr<StatementBlock> &statement_block);
7036  InitialBlock(const InitialBlock &obj);
7037 
7038  virtual ~InitialBlock() = default;
7039 
7040  /// \}
7041 
7042  /**
7043  * \brief Check if the ast node is an instance of ast::InitialBlock
7044  * \return true as object is of type ast::InitialBlock
7045  */
7046  bool is_initial_block() const noexcept override { return true; }
7047 
7048  /**
7049  * \brief Return a copy of the current node
7050  *
7051  * Recursively make a new copy/clone of the current node including
7052  * all members and return a pointer to the node. This is used for
7053  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7054  * ast.
7055  *
7056  * @return pointer to the clone/copy of the current node
7057  */
7058  InitialBlock *clone() const override { return new InitialBlock(*this); }
7059 
7060  /// \name Getters
7061  /// \{
7062 
7063  /**
7064  * \brief Return type (ast::AstNodeType) of ast node
7065  *
7066  * Every node in the ast has a type defined in ast::AstNodeType and this
7067  * function is used to retrieve the same.
7068  *
7069  * \return ast node type i.e. ast::AstNodeType::INITIAL_BLOCK
7070  *
7071  * \sa Ast::get_node_type_name
7072  */
7073  AstNodeType get_node_type() const noexcept override {
7075  }
7076 
7077  /**
7078  * \brief Return type (ast::AstNodeType) of ast node as std::string
7079  *
7080  * Every node in the ast has a type defined in ast::AstNodeType.
7081  * This type name can be returned as a std::string for printing
7082  * node to text/json form.
7083  *
7084  * \return name of the node type as a string i.e. "InitialBlock"
7085  *
7086  * \sa Ast::get_node_name
7087  */
7088  std::string get_node_type_name() const noexcept override {
7089  return "InitialBlock";
7090  }
7091 
7092  /**
7093  * \brief Return NMODL statement of ast node as std::string
7094  *
7095  * Every node is related to a special statement in the NMODL. This
7096  * statement can be returned as a std::string for printing to
7097  * text/json form.
7098  *
7099  * \return name of the statement as a string i.e. "INITIAL "
7100  *
7101  * \sa Ast::get_nmodl_name
7102  */
7103  std::string get_nmodl_name() const noexcept override { return "INITIAL "; }
7104 
7105  /**
7106  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7107  */
7108  std::shared_ptr<Ast> get_shared_ptr() override {
7109  return std::static_pointer_cast<InitialBlock>(shared_from_this());
7110  }
7111 
7112  /**
7113  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7114  */
7115  std::shared_ptr<const Ast> get_shared_ptr() const override {
7116  return std::static_pointer_cast<const InitialBlock>(shared_from_this());
7117  }
7118 
7119  /**
7120  * \brief Return associated token for the current ast node
7121  *
7122  * Not all ast nodes have token information. For example,
7123  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
7124  * solution of ODEs. In this case, we return nullptr to store in the
7125  * nmodl::symtab::SymbolTable.
7126  *
7127  * \return pointer to token if exist otherwise nullptr
7128  */
7129  const ModToken *get_token() const noexcept override { return token.get(); }
7130 
7131  /**
7132  * \brief Return associated symbol table for the current ast node
7133  *
7134  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7135  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7136  * and it can be accessed using this method.
7137  *
7138  * \return pointer to the symbol table
7139  *
7140  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7141  */
7142  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
7143 
7144  /**
7145  * \brief Getter for member variable \ref InitialBlock.statement_block
7146  */
7147  const std::shared_ptr<StatementBlock> &get_statement_block() const
7148  noexcept override {
7149  return statement_block;
7150  }
7151 
7152  /// \}
7153 
7154  /// \name Setters
7155  /// \{
7156 
7157  /**
7158  * \brief Set token for the current ast node
7159  */
7160  void set_token(const ModToken &tok) {
7161  token = std::make_shared<ModToken>(tok);
7162  }
7163 
7164  /**
7165  * \brief Set symbol table for the current ast node
7166  *
7167  * Top level, block scoped nodes store symbol table in the ast node.
7168  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7169  * for every node in the ast.
7170  *
7171  * \sa nmodl::visitor::SymtabVisitor
7172  */
7173  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
7174  symtab = newsymtab;
7175  }
7176 
7177  /**
7178  * \brief Setter for member variable \ref InitialBlock.statement_block (rvalue
7179  * reference)
7180  */
7181  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
7182 
7183  /**
7184  * \brief Setter for member variable \ref InitialBlock.statement_block
7185  */
7186  void
7187  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
7188 
7189  /// \}
7190 
7191  /// \name Visitor
7192  /// \{
7193 
7194  /**
7195  * \brief visit children i.e. member variables of current node using provided
7196  * visitor
7197  *
7198  * Different nodes in the AST have different members (i.e. children). This
7199  * method recursively visits children using provided visitor.
7200  *
7201  * \param v Concrete visitor that will be used to recursively visit children
7202  *
7203  * \sa Ast::visit_children for example.
7204  */
7205  void visit_children(visitor::Visitor &v) override;
7206 
7207  /**
7208  * \brief accept (or visit) the current AST node using provided visitor
7209  *
7210  * Instead of visiting children of AST node, like Ast::visit_children,
7211  * accept allows to visit the current node itself using provided concrete
7212  * visitor.
7213  *
7214  * \param v Concrete visitor that will be used to recursively visit node
7215  *
7216  * \sa Ast::accept for example.
7217  */
7218  void accept(visitor::Visitor &v) override;
7219 
7220  /// \}
7221 
7222 private:
7223  /**
7224  * \brief Set this object as parent for all the children
7225  *
7226  * This should be called in every object (with children) constructor
7227  * to set parents. Since it is called only in the constructors it
7228  * should not be virtual to avoid ambiguities (issue #295).
7229  */
7230  void set_parent_in_children();
7231 };
7232 
7233 /** @} */ // end of ast_class
7234 
7235 } // namespace ast
7236 } // namespace nmodl
7237 #endif // !NMODL_AST_INITIAL_BLOCK_HPP
7238 #ifndef NMODL_AST_CONSTRUCTOR_BLOCK_HPP
7239 #define NMODL_AST_CONSTRUCTOR_BLOCK_HPP
7240 
7241 namespace nmodl {
7242 namespace ast {
7243 
7244 /**
7245  * @addtogroup ast_class
7246  * @ingroup ast
7247  * @{
7248  */
7249 
7250 /**
7251  * \brief Represents a `CONSTRUCTOR` block in the NMODL
7252  *
7253  * The code in the `CONSTRUCTOR` is called when the channel is instantiated.
7254  * Like any other global block, `CONSTRUCTOR` block can have any statements. It
7255  * often used with `VERBATIM` block for initialization purpose :
7256  *
7257  * \code{.mod}
7258  * CONSTRUCTOR {
7259  * VERBATIM
7260  * if (ifarg(1)) { id= *getarg(1); } else { id= -1; }
7261  * ENDVERBATIM
7262  * }
7263  * \endcode
7264  *
7265  * \sa ast::DestructorBlock
7266  *
7267  */
7268 class ConstructorBlock : public Block {
7269 private:
7270  /// Block with statements vector
7271  std::shared_ptr<StatementBlock> statement_block;
7272  /// token with location information
7273  std::shared_ptr<ModToken> token;
7274  /// symbol table for a block
7275  symtab::SymbolTable *symtab = nullptr;
7276 
7277 public:
7278  /// \name Ctor & dtor
7279  /// \{
7280 
7281  explicit ConstructorBlock(StatementBlock *statement_block);
7282  explicit ConstructorBlock(
7283  const std::shared_ptr<StatementBlock> &statement_block);
7284  ConstructorBlock(const ConstructorBlock &obj);
7285 
7286  virtual ~ConstructorBlock() = default;
7287 
7288  /// \}
7289 
7290  /**
7291  * \brief Check if the ast node is an instance of ast::ConstructorBlock
7292  * \return true as object is of type ast::ConstructorBlock
7293  */
7294  bool is_constructor_block() const noexcept override { return true; }
7295 
7296  /**
7297  * \brief Return a copy of the current node
7298  *
7299  * Recursively make a new copy/clone of the current node including
7300  * all members and return a pointer to the node. This is used for
7301  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7302  * ast.
7303  *
7304  * @return pointer to the clone/copy of the current node
7305  */
7306  ConstructorBlock *clone() const override {
7307  return new ConstructorBlock(*this);
7308  }
7309 
7310  /// \name Getters
7311  /// \{
7312 
7313  /**
7314  * \brief Return type (ast::AstNodeType) of ast node
7315  *
7316  * Every node in the ast has a type defined in ast::AstNodeType and this
7317  * function is used to retrieve the same.
7318  *
7319  * \return ast node type i.e. ast::AstNodeType::CONSTRUCTOR_BLOCK
7320  *
7321  * \sa Ast::get_node_type_name
7322  */
7323  AstNodeType get_node_type() const noexcept override {
7325  }
7326 
7327  /**
7328  * \brief Return type (ast::AstNodeType) of ast node as std::string
7329  *
7330  * Every node in the ast has a type defined in ast::AstNodeType.
7331  * This type name can be returned as a std::string for printing
7332  * node to text/json form.
7333  *
7334  * \return name of the node type as a string i.e. "ConstructorBlock"
7335  *
7336  * \sa Ast::get_node_name
7337  */
7338  std::string get_node_type_name() const noexcept override {
7339  return "ConstructorBlock";
7340  }
7341 
7342  /**
7343  * \brief Return NMODL statement of ast node as std::string
7344  *
7345  * Every node is related to a special statement in the NMODL. This
7346  * statement can be returned as a std::string for printing to
7347  * text/json form.
7348  *
7349  * \return name of the statement as a string i.e. "CONSTRUCTOR "
7350  *
7351  * \sa Ast::get_nmodl_name
7352  */
7353  std::string get_nmodl_name() const noexcept override {
7354  return "CONSTRUCTOR ";
7355  }
7356 
7357  /**
7358  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7359  */
7360  std::shared_ptr<Ast> get_shared_ptr() override {
7361  return std::static_pointer_cast<ConstructorBlock>(shared_from_this());
7362  }
7363 
7364  /**
7365  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7366  */
7367  std::shared_ptr<const Ast> get_shared_ptr() const override {
7368  return std::static_pointer_cast<const ConstructorBlock>(shared_from_this());
7369  }
7370 
7371  /**
7372  * \brief Return associated token for the current ast node
7373  *
7374  * Not all ast nodes have token information. For example,
7375  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
7376  * solution of ODEs. In this case, we return nullptr to store in the
7377  * nmodl::symtab::SymbolTable.
7378  *
7379  * \return pointer to token if exist otherwise nullptr
7380  */
7381  const ModToken *get_token() const noexcept override { return token.get(); }
7382 
7383  /**
7384  * \brief Return associated symbol table for the current ast node
7385  *
7386  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7387  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7388  * and it can be accessed using this method.
7389  *
7390  * \return pointer to the symbol table
7391  *
7392  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7393  */
7394  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
7395 
7396  /**
7397  * \brief Getter for member variable \ref ConstructorBlock.statement_block
7398  */
7399  const std::shared_ptr<StatementBlock> &get_statement_block() const
7400  noexcept override {
7401  return statement_block;
7402  }
7403 
7404  /// \}
7405 
7406  /// \name Setters
7407  /// \{
7408 
7409  /**
7410  * \brief Set token for the current ast node
7411  */
7412  void set_token(const ModToken &tok) {
7413  token = std::make_shared<ModToken>(tok);
7414  }
7415 
7416  /**
7417  * \brief Set symbol table for the current ast node
7418  *
7419  * Top level, block scoped nodes store symbol table in the ast node.
7420  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7421  * for every node in the ast.
7422  *
7423  * \sa nmodl::visitor::SymtabVisitor
7424  */
7425  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
7426  symtab = newsymtab;
7427  }
7428 
7429  /**
7430  * \brief Setter for member variable \ref ConstructorBlock.statement_block
7431  * (rvalue reference)
7432  */
7433  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
7434 
7435  /**
7436  * \brief Setter for member variable \ref ConstructorBlock.statement_block
7437  */
7438  void
7439  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
7440 
7441  /// \}
7442 
7443  /// \name Visitor
7444  /// \{
7445 
7446  /**
7447  * \brief visit children i.e. member variables of current node using provided
7448  * visitor
7449  *
7450  * Different nodes in the AST have different members (i.e. children). This
7451  * method recursively visits children using provided visitor.
7452  *
7453  * \param v Concrete visitor that will be used to recursively visit children
7454  *
7455  * \sa Ast::visit_children for example.
7456  */
7457  void visit_children(visitor::Visitor &v) override;
7458 
7459  /**
7460  * \brief accept (or visit) the current AST node using provided visitor
7461  *
7462  * Instead of visiting children of AST node, like Ast::visit_children,
7463  * accept allows to visit the current node itself using provided concrete
7464  * visitor.
7465  *
7466  * \param v Concrete visitor that will be used to recursively visit node
7467  *
7468  * \sa Ast::accept for example.
7469  */
7470  void accept(visitor::Visitor &v) override;
7471 
7472  /// \}
7473 
7474 private:
7475  /**
7476  * \brief Set this object as parent for all the children
7477  *
7478  * This should be called in every object (with children) constructor
7479  * to set parents. Since it is called only in the constructors it
7480  * should not be virtual to avoid ambiguities (issue #295).
7481  */
7482  void set_parent_in_children();
7483 };
7484 
7485 /** @} */ // end of ast_class
7486 
7487 } // namespace ast
7488 } // namespace nmodl
7489 #endif // !NMODL_AST_CONSTRUCTOR_BLOCK_HPP
7490 #ifndef NMODL_AST_DESTRUCTOR_BLOCK_HPP
7491 #define NMODL_AST_DESTRUCTOR_BLOCK_HPP
7492 
7493 namespace nmodl {
7494 namespace ast {
7495 
7496 /**
7497  * @addtogroup ast_class
7498  * @ingroup ast
7499  * @{
7500  */
7501 
7502 /**
7503  * \brief Represents a `DESTRUCTOR` block in the NMODL
7504  *
7505  * The code in the `DESTRUCTOR` is called when the channel instance is deleted.
7506  * It often used with `VERBATIM` block for finalization purpose :
7507  *
7508  * \code{.mod}
7509  * DESTRUCTOR {
7510  * VERBATIM {
7511  * nsyn = maxsyn = 0;
7512  * free(PRECAST);
7513  * link = 0;
7514  * }
7515  * ENDVERBATIM
7516  * }
7517  * \endcode
7518  *
7519  * \sa ast::ConstructorBlock
7520  *
7521  */
7522 class DestructorBlock : public Block {
7523 private:
7524  /// Block with statements vector
7525  std::shared_ptr<StatementBlock> statement_block;
7526  /// token with location information
7527  std::shared_ptr<ModToken> token;
7528  /// symbol table for a block
7529  symtab::SymbolTable *symtab = nullptr;
7530 
7531 public:
7532  /// \name Ctor & dtor
7533  /// \{
7534 
7535  explicit DestructorBlock(StatementBlock *statement_block);
7536  explicit DestructorBlock(
7537  const std::shared_ptr<StatementBlock> &statement_block);
7538  DestructorBlock(const DestructorBlock &obj);
7539 
7540  virtual ~DestructorBlock() = default;
7541 
7542  /// \}
7543 
7544  /**
7545  * \brief Check if the ast node is an instance of ast::DestructorBlock
7546  * \return true as object is of type ast::DestructorBlock
7547  */
7548  bool is_destructor_block() const noexcept override { return true; }
7549 
7550  /**
7551  * \brief Return a copy of the current node
7552  *
7553  * Recursively make a new copy/clone of the current node including
7554  * all members and return a pointer to the node. This is used for
7555  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7556  * ast.
7557  *
7558  * @return pointer to the clone/copy of the current node
7559  */
7560  DestructorBlock *clone() const override { return new DestructorBlock(*this); }
7561 
7562  /// \name Getters
7563  /// \{
7564 
7565  /**
7566  * \brief Return type (ast::AstNodeType) of ast node
7567  *
7568  * Every node in the ast has a type defined in ast::AstNodeType and this
7569  * function is used to retrieve the same.
7570  *
7571  * \return ast node type i.e. ast::AstNodeType::DESTRUCTOR_BLOCK
7572  *
7573  * \sa Ast::get_node_type_name
7574  */
7575  AstNodeType get_node_type() const noexcept override {
7577  }
7578 
7579  /**
7580  * \brief Return type (ast::AstNodeType) of ast node as std::string
7581  *
7582  * Every node in the ast has a type defined in ast::AstNodeType.
7583  * This type name can be returned as a std::string for printing
7584  * node to text/json form.
7585  *
7586  * \return name of the node type as a string i.e. "DestructorBlock"
7587  *
7588  * \sa Ast::get_node_name
7589  */
7590  std::string get_node_type_name() const noexcept override {
7591  return "DestructorBlock";
7592  }
7593 
7594  /**
7595  * \brief Return NMODL statement of ast node as std::string
7596  *
7597  * Every node is related to a special statement in the NMODL. This
7598  * statement can be returned as a std::string for printing to
7599  * text/json form.
7600  *
7601  * \return name of the statement as a string i.e. "DESTRUCTOR "
7602  *
7603  * \sa Ast::get_nmodl_name
7604  */
7605  std::string get_nmodl_name() const noexcept override { return "DESTRUCTOR "; }
7606 
7607  /**
7608  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7609  */
7610  std::shared_ptr<Ast> get_shared_ptr() override {
7611  return std::static_pointer_cast<DestructorBlock>(shared_from_this());
7612  }
7613 
7614  /**
7615  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7616  */
7617  std::shared_ptr<const Ast> get_shared_ptr() const override {
7618  return std::static_pointer_cast<const DestructorBlock>(shared_from_this());
7619  }
7620 
7621  /**
7622  * \brief Return associated token for the current ast node
7623  *
7624  * Not all ast nodes have token information. For example,
7625  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
7626  * solution of ODEs. In this case, we return nullptr to store in the
7627  * nmodl::symtab::SymbolTable.
7628  *
7629  * \return pointer to token if exist otherwise nullptr
7630  */
7631  const ModToken *get_token() const noexcept override { return token.get(); }
7632 
7633  /**
7634  * \brief Return associated symbol table for the current ast node
7635  *
7636  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7637  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7638  * and it can be accessed using this method.
7639  *
7640  * \return pointer to the symbol table
7641  *
7642  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7643  */
7644  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
7645 
7646  /**
7647  * \brief Getter for member variable \ref DestructorBlock.statement_block
7648  */
7649  const std::shared_ptr<StatementBlock> &get_statement_block() const
7650  noexcept override {
7651  return statement_block;
7652  }
7653 
7654  /// \}
7655 
7656  /// \name Setters
7657  /// \{
7658 
7659  /**
7660  * \brief Set token for the current ast node
7661  */
7662  void set_token(const ModToken &tok) {
7663  token = std::make_shared<ModToken>(tok);
7664  }
7665 
7666  /**
7667  * \brief Set symbol table for the current ast node
7668  *
7669  * Top level, block scoped nodes store symbol table in the ast node.
7670  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7671  * for every node in the ast.
7672  *
7673  * \sa nmodl::visitor::SymtabVisitor
7674  */
7675  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
7676  symtab = newsymtab;
7677  }
7678 
7679  /**
7680  * \brief Setter for member variable \ref DestructorBlock.statement_block
7681  * (rvalue reference)
7682  */
7683  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
7684 
7685  /**
7686  * \brief Setter for member variable \ref DestructorBlock.statement_block
7687  */
7688  void
7689  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
7690 
7691  /// \}
7692 
7693  /// \name Visitor
7694  /// \{
7695 
7696  /**
7697  * \brief visit children i.e. member variables of current node using provided
7698  * visitor
7699  *
7700  * Different nodes in the AST have different members (i.e. children). This
7701  * method recursively visits children using provided visitor.
7702  *
7703  * \param v Concrete visitor that will be used to recursively visit children
7704  *
7705  * \sa Ast::visit_children for example.
7706  */
7707  void visit_children(visitor::Visitor &v) override;
7708 
7709  /**
7710  * \brief accept (or visit) the current AST node using provided visitor
7711  *
7712  * Instead of visiting children of AST node, like Ast::visit_children,
7713  * accept allows to visit the current node itself using provided concrete
7714  * visitor.
7715  *
7716  * \param v Concrete visitor that will be used to recursively visit node
7717  *
7718  * \sa Ast::accept for example.
7719  */
7720  void accept(visitor::Visitor &v) override;
7721 
7722  /// \}
7723 
7724 private:
7725  /**
7726  * \brief Set this object as parent for all the children
7727  *
7728  * This should be called in every object (with children) constructor
7729  * to set parents. Since it is called only in the constructors it
7730  * should not be virtual to avoid ambiguities (issue #295).
7731  */
7732  void set_parent_in_children();
7733 };
7734 
7735 /** @} */ // end of ast_class
7736 
7737 } // namespace ast
7738 } // namespace nmodl
7739 #endif // !NMODL_AST_DESTRUCTOR_BLOCK_HPP
7740 #ifndef NMODL_AST_STATEMENT_BLOCK_HPP
7741 #define NMODL_AST_STATEMENT_BLOCK_HPP
7742 
7743 namespace nmodl {
7744 namespace ast {
7745 
7746 /**
7747  * @addtogroup ast_class
7748  * @ingroup ast
7749  * @{
7750  */
7751 
7752 /**
7753  * \brief Represents block encapsulating list of statements
7754  *
7755  * Statement block is used to hold list of statements between `{ }`. This
7756  * represents a new block scope in the mod file and has following form :
7757  *
7758  * \code{.mod}
7759  * {
7760  * statement1
7761  * {
7762  * statement2
7763  * }
7764  * }
7765  * \endcode
7766  *
7767  * Note that the statement blocks can be nested where inner block will
7768  * be wrapped as statement with ast::ExpressionStatement.
7769  *
7770  */
7771 class StatementBlock : public Block {
7772 private:
7773  /// Vector of statements
7775  /// token with location information
7776  std::shared_ptr<ModToken> token;
7777  /// symbol table for a block
7778  symtab::SymbolTable *symtab = nullptr;
7779 
7780 public:
7781  /// \name Ctor & dtor
7782  /// \{
7783 
7784  explicit StatementBlock(StatementVector statements);
7785  StatementBlock(const StatementBlock &obj);
7786 
7787  virtual ~StatementBlock() = default;
7788 
7789  /// \}
7790 
7791  /**
7792  * \brief Check if the ast node is an instance of ast::StatementBlock
7793  * \return true as object is of type ast::StatementBlock
7794  */
7795  bool is_statement_block() const noexcept override { return true; }
7796 
7797  /**
7798  * \brief Return a copy of the current node
7799  *
7800  * Recursively make a new copy/clone of the current node including
7801  * all members and return a pointer to the node. This is used for
7802  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7803  * ast.
7804  *
7805  * @return pointer to the clone/copy of the current node
7806  */
7807  StatementBlock *clone() const override { return new StatementBlock(*this); }
7808 
7809  /// \name Getters
7810  /// \{
7811 
7812  /**
7813  * \brief Return type (ast::AstNodeType) of ast node
7814  *
7815  * Every node in the ast has a type defined in ast::AstNodeType and this
7816  * function is used to retrieve the same.
7817  *
7818  * \return ast node type i.e. ast::AstNodeType::STATEMENT_BLOCK
7819  *
7820  * \sa Ast::get_node_type_name
7821  */
7822  AstNodeType get_node_type() const noexcept override {
7824  }
7825 
7826  /**
7827  * \brief Return type (ast::AstNodeType) of ast node as std::string
7828  *
7829  * Every node in the ast has a type defined in ast::AstNodeType.
7830  * This type name can be returned as a std::string for printing
7831  * node to text/json form.
7832  *
7833  * \return name of the node type as a string i.e. "StatementBlock"
7834  *
7835  * \sa Ast::get_node_name
7836  */
7837  std::string get_node_type_name() const noexcept override {
7838  return "StatementBlock";
7839  }
7840 
7841  /**
7842  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7843  */
7844  std::shared_ptr<Ast> get_shared_ptr() override {
7845  return std::static_pointer_cast<StatementBlock>(shared_from_this());
7846  }
7847 
7848  /**
7849  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7850  */
7851  std::shared_ptr<const Ast> get_shared_ptr() const override {
7852  return std::static_pointer_cast<const StatementBlock>(shared_from_this());
7853  }
7854 
7855  /**
7856  * \brief Return associated token for the current ast node
7857  *
7858  * Not all ast nodes have token information. For example,
7859  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
7860  * solution of ODEs. In this case, we return nullptr to store in the
7861  * nmodl::symtab::SymbolTable.
7862  *
7863  * \return pointer to token if exist otherwise nullptr
7864  */
7865  const ModToken *get_token() const noexcept override { return token.get(); }
7866 
7867  /**
7868  * \brief Return associated symbol table for the current ast node
7869  *
7870  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7871  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7872  * and it can be accessed using this method.
7873  *
7874  * \return pointer to the symbol table
7875  *
7876  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7877  */
7878  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
7879 
7880  /**
7881  * \brief Add member to statements by raw pointer
7882  */
7884  statements.emplace_back(n);
7885 
7886  // set parents
7887  n->set_parent(this);
7888  }
7889 
7890  /**
7891  * \brief Add member to statements by shared_ptr
7892  */
7893  void emplace_back_statement(std::shared_ptr<Statement> n) {
7894  statements.emplace_back(n);
7895  // set parents
7896  n->set_parent(this);
7897  }
7898 
7899  /**
7900  * \brief Erase member to statements
7901  */
7902  StatementVector::const_iterator
7903  erase_statement(StatementVector::const_iterator first) {
7904  auto first_it = const_iter_cast(statements, first);
7905  return statements.erase(first_it);
7906  }
7907  /**
7908  * \brief Erase members to statements
7909  */
7910  StatementVector::const_iterator
7911  erase_statement(StatementVector::const_iterator first,
7912  StatementVector::const_iterator last) {
7913  auto first_it = const_iter_cast(statements, first);
7914  auto last_it = const_iter_cast(statements, last);
7915  return statements.erase(first_it, last_it);
7916  }
7917  /**
7918  * \brief Erase non-consecutive members to statements
7919  *
7920  * loosely following the cpp reference of remove_if
7921  */
7922  size_t erase_statement(std::unordered_set<Statement *> &to_be_erased) {
7923  auto first = statements.begin();
7924  auto last = statements.end();
7925  auto result = first;
7926 
7927  while (first != last) {
7928  // automatically erase dangling pointers from the uset while
7929  // looking for them to erase them in the vector
7930  if (to_be_erased.erase(first->get()) == 0) {
7931  reset_statement(result, *first);
7932  ++result;
7933  }
7934  ++first;
7935  }
7936 
7937  size_t out = last - result;
7938  erase_statement(result, last);
7939 
7940  return out;
7941  }
7942 
7943  /**
7944  * \brief Insert member to statements
7945  */
7946  StatementVector::const_iterator
7947  insert_statement(StatementVector::const_iterator position,
7948  const std::shared_ptr<Statement> &n) {
7949  n->set_parent(this);
7950  auto pos_it = const_iter_cast(statements, position);
7951  return statements.insert(pos_it, n);
7952  }
7953  /**
7954  * \brief Insert members to statements
7955  */
7956  template <class NodeType, class InputIterator>
7957  void insert_statement(StatementVector::const_iterator position, NodeType &to,
7958  InputIterator first, InputIterator last) {
7959 
7960  for (auto it = first; it != last; ++it) {
7961  auto &n = *it;
7962  // set parents
7963  n->set_parent(this);
7964  }
7965  auto pos_it = const_iter_cast(statements, position);
7966  auto first_it = const_iter_cast(to, first);
7967  auto last_it = const_iter_cast(to, last);
7968  statements.insert(pos_it, first_it, last_it);
7969  }
7970 
7971  /**
7972  * \brief Reset member to statements
7973  */
7974  void reset_statement(StatementVector::const_iterator position, Statement *n) {
7975  // set parents
7976  n->set_parent(this);
7977 
7978  statements[position - statements.begin()].reset(n);
7979  }
7980 
7981  /**
7982  * \brief Reset member to statements
7983  */
7984  void reset_statement(StatementVector::const_iterator position,
7985  std::shared_ptr<Statement> n) {
7986  // set parents
7987  n->set_parent(this);
7988 
7989  statements[position - statements.begin()] = n;
7990  }
7991 
7992  /**
7993  * \brief Getter for member variable \ref StatementBlock.statements
7994  */
7995  const StatementVector &get_statements() const noexcept { return statements; }
7996 
7997  /// \}
7998 
7999  /// \name Setters
8000  /// \{
8001 
8002  /**
8003  * \brief Set token for the current ast node
8004  */
8005  void set_token(const ModToken &tok) {
8006  token = std::make_shared<ModToken>(tok);
8007  }
8008 
8009  /**
8010  * \brief Set symbol table for the current ast node
8011  *
8012  * Top level, block scoped nodes store symbol table in the ast node.
8013  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8014  * for every node in the ast.
8015  *
8016  * \sa nmodl::visitor::SymtabVisitor
8017  */
8018  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
8019  symtab = newsymtab;
8020  }
8021 
8022  /**
8023  * \brief Setter for member variable \ref StatementBlock.statements (rvalue
8024  * reference)
8025  */
8026  void set_statements(StatementVector &&statements);
8027 
8028  /**
8029  * \brief Setter for member variable \ref StatementBlock.statements
8030  */
8031  void set_statements(const StatementVector &statements);
8032 
8033  /// \}
8034 
8035  /// \name Visitor
8036  /// \{
8037 
8038  /**
8039  * \brief visit children i.e. member variables of current node using provided
8040  * visitor
8041  *
8042  * Different nodes in the AST have different members (i.e. children). This
8043  * method recursively visits children using provided visitor.
8044  *
8045  * \param v Concrete visitor that will be used to recursively visit children
8046  *
8047  * \sa Ast::visit_children for example.
8048  */
8049  void visit_children(visitor::Visitor &v) override;
8050 
8051  /**
8052  * \brief accept (or visit) the current AST node using provided visitor
8053  *
8054  * Instead of visiting children of AST node, like Ast::visit_children,
8055  * accept allows to visit the current node itself using provided concrete
8056  * visitor.
8057  *
8058  * \param v Concrete visitor that will be used to recursively visit node
8059  *
8060  * \sa Ast::accept for example.
8061  */
8062  void accept(visitor::Visitor &v) override;
8063 
8064  /// \}
8065 
8066 private:
8067  /**
8068  * \brief Set this object as parent for all the children
8069  *
8070  * This should be called in every object (with children) constructor
8071  * to set parents. Since it is called only in the constructors it
8072  * should not be virtual to avoid ambiguities (issue #295).
8073  */
8074  void set_parent_in_children();
8075 };
8076 
8077 /** @} */ // end of ast_class
8078 
8079 } // namespace ast
8080 } // namespace nmodl
8081 #endif // !NMODL_AST_STATEMENT_BLOCK_HPP
8082 #ifndef NMODL_AST_DERIVATIVE_BLOCK_HPP
8083 #define NMODL_AST_DERIVATIVE_BLOCK_HPP
8084 
8085 namespace nmodl {
8086 namespace ast {
8087 
8088 /**
8089  * @addtogroup ast_class
8090  * @ingroup ast
8091  * @{
8092  */
8093 
8094 /**
8095  * \brief Represents `DERIVATIVE` block in the NMODL
8096  *
8097  * This block is used to assign values to the derivatives of those
8098  * `STATE`s that are described by differential equations. The statements
8099  * in this block are of the form \f$y' = expr\f$. Here is an example :
8100  *
8101  * \code{.mod}
8102  * DERIVATIVE states {
8103  * rates(v)
8104  * m' = (minf-m)/mtau
8105  * h' = (hinf-h)/htau
8106  * }
8107  * \endcode
8108  *
8109  */
8110 class DerivativeBlock : public Block {
8111 private:
8112  /// Name of the derivative block
8113  std::shared_ptr<Name> name;
8114  /// Block with statements vector
8115  std::shared_ptr<StatementBlock> statement_block;
8116  /// token with location information
8117  std::shared_ptr<ModToken> token;
8118  /// symbol table for a block
8119  symtab::SymbolTable *symtab = nullptr;
8120 
8121 public:
8122  /// \name Ctor & dtor
8123  /// \{
8124 
8125  explicit DerivativeBlock(Name *name, StatementBlock *statement_block);
8126  explicit DerivativeBlock(
8127  const std::shared_ptr<Name> &name,
8128  const std::shared_ptr<StatementBlock> &statement_block);
8129  DerivativeBlock(const DerivativeBlock &obj);
8130 
8131  virtual ~DerivativeBlock() = default;
8132 
8133  /// \}
8134 
8135  /**
8136  * \brief Check if the ast node is an instance of ast::DerivativeBlock
8137  * \return true as object is of type ast::DerivativeBlock
8138  */
8139  bool is_derivative_block() const noexcept override { return true; }
8140 
8141  /**
8142  * \brief Return a copy of the current node
8143  *
8144  * Recursively make a new copy/clone of the current node including
8145  * all members and return a pointer to the node. This is used for
8146  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8147  * ast.
8148  *
8149  * @return pointer to the clone/copy of the current node
8150  */
8151  DerivativeBlock *clone() const override { return new DerivativeBlock(*this); }
8152 
8153  /// \name Getters
8154  /// \{
8155 
8156  /**
8157  * \brief Return type (ast::AstNodeType) of ast node
8158  *
8159  * Every node in the ast has a type defined in ast::AstNodeType and this
8160  * function is used to retrieve the same.
8161  *
8162  * \return ast node type i.e. ast::AstNodeType::DERIVATIVE_BLOCK
8163  *
8164  * \sa Ast::get_node_type_name
8165  */
8166  AstNodeType get_node_type() const noexcept override {
8168  }
8169 
8170  /**
8171  * \brief Return type (ast::AstNodeType) of ast node as std::string
8172  *
8173  * Every node in the ast has a type defined in ast::AstNodeType.
8174  * This type name can be returned as a std::string for printing
8175  * node to text/json form.
8176  *
8177  * \return name of the node type as a string i.e. "DerivativeBlock"
8178  *
8179  * \sa Ast::get_node_name
8180  */
8181  std::string get_node_type_name() const noexcept override {
8182  return "DerivativeBlock";
8183  }
8184 
8185  /**
8186  * \brief Return NMODL statement of ast node as std::string
8187  *
8188  * Every node is related to a special statement in the NMODL. This
8189  * statement can be returned as a std::string for printing to
8190  * text/json form.
8191  *
8192  * \return name of the statement as a string i.e. "DERIVATIVE "
8193  *
8194  * \sa Ast::get_nmodl_name
8195  */
8196  std::string get_nmodl_name() const noexcept override { return "DERIVATIVE "; }
8197 
8198  /**
8199  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8200  */
8201  std::shared_ptr<Ast> get_shared_ptr() override {
8202  return std::static_pointer_cast<DerivativeBlock>(shared_from_this());
8203  }
8204 
8205  /**
8206  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8207  */
8208  std::shared_ptr<const Ast> get_shared_ptr() const override {
8209  return std::static_pointer_cast<const DerivativeBlock>(shared_from_this());
8210  }
8211 
8212  /**
8213  * \brief Return associated token for the current ast node
8214  *
8215  * Not all ast nodes have token information. For example,
8216  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
8217  * solution of ODEs. In this case, we return nullptr to store in the
8218  * nmodl::symtab::SymbolTable.
8219  *
8220  * \return pointer to token if exist otherwise nullptr
8221  */
8222  const ModToken *get_token() const noexcept override { return token.get(); }
8223 
8224  /**
8225  * \brief Return associated symbol table for the current ast node
8226  *
8227  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8228  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8229  * and it can be accessed using this method.
8230  *
8231  * \return pointer to the symbol table
8232  *
8233  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8234  */
8235  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
8236 
8237  /**
8238  * \brief Return name of the node
8239  *
8240  * Some ast nodes have a member marked designated as node name. For example,
8241  * in case of this ast::Name has name designated as a
8242  * node name.
8243  *
8244  * @return name of the node as std::string
8245  *
8246  * \sa Ast::get_node_type_name
8247  */
8248  std::string get_node_name() const override;
8249 
8250  /**
8251  * \brief Getter for member variable \ref DerivativeBlock.name
8252  */
8253  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
8254 
8255  /**
8256  * \brief Getter for member variable \ref DerivativeBlock.statement_block
8257  */
8258  const std::shared_ptr<StatementBlock> &get_statement_block() const
8259  noexcept override {
8260  return statement_block;
8261  }
8262 
8263  /// \}
8264 
8265  /// \name Setters
8266  /// \{
8267 
8268  /**
8269  * \brief Set token for the current ast node
8270  */
8271  void set_token(const ModToken &tok) {
8272  token = std::make_shared<ModToken>(tok);
8273  }
8274 
8275  /**
8276  * \brief Set symbol table for the current ast node
8277  *
8278  * Top level, block scoped nodes store symbol table in the ast node.
8279  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8280  * for every node in the ast.
8281  *
8282  * \sa nmodl::visitor::SymtabVisitor
8283  */
8284  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
8285  symtab = newsymtab;
8286  }
8287 
8288  /**
8289  * \brief Setter for member variable \ref DerivativeBlock.name (rvalue
8290  * reference)
8291  */
8292  void set_name(std::shared_ptr<Name> &&name);
8293 
8294  /**
8295  * \brief Setter for member variable \ref DerivativeBlock.name
8296  */
8297  void set_name(const std::shared_ptr<Name> &name);
8298 
8299  /**
8300  * \brief Setter for member variable \ref DerivativeBlock.statement_block
8301  * (rvalue reference)
8302  */
8303  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
8304 
8305  /**
8306  * \brief Setter for member variable \ref DerivativeBlock.statement_block
8307  */
8308  void
8309  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
8310 
8311  /// \}
8312 
8313  /// \name Visitor
8314  /// \{
8315 
8316  /**
8317  * \brief visit children i.e. member variables of current node using provided
8318  * visitor
8319  *
8320  * Different nodes in the AST have different members (i.e. children). This
8321  * method recursively visits children using provided visitor.
8322  *
8323  * \param v Concrete visitor that will be used to recursively visit children
8324  *
8325  * \sa Ast::visit_children for example.
8326  */
8327  void visit_children(visitor::Visitor &v) override;
8328 
8329  /**
8330  * \brief accept (or visit) the current AST node using provided visitor
8331  *
8332  * Instead of visiting children of AST node, like Ast::visit_children,
8333  * accept allows to visit the current node itself using provided concrete
8334  * visitor.
8335  *
8336  * \param v Concrete visitor that will be used to recursively visit node
8337  *
8338  * \sa Ast::accept for example.
8339  */
8340  void accept(visitor::Visitor &v) override;
8341 
8342  /// \}
8343 
8344 private:
8345  /**
8346  * \brief Set this object as parent for all the children
8347  *
8348  * This should be called in every object (with children) constructor
8349  * to set parents. Since it is called only in the constructors it
8350  * should not be virtual to avoid ambiguities (issue #295).
8351  */
8352  void set_parent_in_children();
8353 };
8354 
8355 /** @} */ // end of ast_class
8356 
8357 } // namespace ast
8358 } // namespace nmodl
8359 #endif // !NMODL_AST_DERIVATIVE_BLOCK_HPP
8360 #ifndef NMODL_AST_LINEAR_BLOCK_HPP
8361 #define NMODL_AST_LINEAR_BLOCK_HPP
8362 
8363 namespace nmodl {
8364 namespace ast {
8365 
8366 /**
8367  * @addtogroup ast_class
8368  * @ingroup ast
8369  * @{
8370  */
8371 
8372 /**
8373  * \brief Represents `LINEAR` block in the NMODL
8374  *
8375  *
8376  * A set of simultaneous equations can be specified in a `LINEAR` block.
8377  * Here is an example :
8378  *
8379  * \code{.mod}
8380  * LINEAR clamp {
8381  * LOCAL t1, t2
8382  * t1 = tau1/dt
8383  * t2 = tau2/dt
8384  * ~ vi = v + fac*vo - fac*v
8385  * ~ t2*vo - t2*vo0 + vo = -gain * e
8386  * ~ -stim - e + vi - e + t1*vi - t1*e - t1*(vi0 - e0) = 0
8387  * }
8388  * \endcode
8389  *
8390  */
8391 class LinearBlock : public Block {
8392 private:
8393  /// Name of the linear block
8394  std::shared_ptr<Name> name;
8395  /// TODO
8397  /// Block with statements vector
8398  std::shared_ptr<StatementBlock> statement_block;
8399  /// token with location information
8400  std::shared_ptr<ModToken> token;
8401  /// symbol table for a block
8402  symtab::SymbolTable *symtab = nullptr;
8403 
8404 public:
8405  /// \name Ctor & dtor
8406  /// \{
8407 
8408  explicit LinearBlock(Name *name, NameVector solvefor,
8409  StatementBlock *statement_block);
8410  explicit LinearBlock(const std::shared_ptr<Name> &name,
8411  const NameVector &solvefor,
8412  const std::shared_ptr<StatementBlock> &statement_block);
8413  LinearBlock(const LinearBlock &obj);
8414 
8415  virtual ~LinearBlock() = default;
8416 
8417  /// \}
8418 
8419  /**
8420  * \brief Check if the ast node is an instance of ast::LinearBlock
8421  * \return true as object is of type ast::LinearBlock
8422  */
8423  bool is_linear_block() const noexcept override { return true; }
8424 
8425  /**
8426  * \brief Return a copy of the current node
8427  *
8428  * Recursively make a new copy/clone of the current node including
8429  * all members and return a pointer to the node. This is used for
8430  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8431  * ast.
8432  *
8433  * @return pointer to the clone/copy of the current node
8434  */
8435  LinearBlock *clone() const override { return new LinearBlock(*this); }
8436 
8437  /// \name Getters
8438  /// \{
8439 
8440  /**
8441  * \brief Return type (ast::AstNodeType) of ast node
8442  *
8443  * Every node in the ast has a type defined in ast::AstNodeType and this
8444  * function is used to retrieve the same.
8445  *
8446  * \return ast node type i.e. ast::AstNodeType::LINEAR_BLOCK
8447  *
8448  * \sa Ast::get_node_type_name
8449  */
8450  AstNodeType get_node_type() const noexcept override {
8452  }
8453 
8454  /**
8455  * \brief Return type (ast::AstNodeType) of ast node as std::string
8456  *
8457  * Every node in the ast has a type defined in ast::AstNodeType.
8458  * This type name can be returned as a std::string for printing
8459  * node to text/json form.
8460  *
8461  * \return name of the node type as a string i.e. "LinearBlock"
8462  *
8463  * \sa Ast::get_node_name
8464  */
8465  std::string get_node_type_name() const noexcept override {
8466  return "LinearBlock";
8467  }
8468 
8469  /**
8470  * \brief Return NMODL statement of ast node as std::string
8471  *
8472  * Every node is related to a special statement in the NMODL. This
8473  * statement can be returned as a std::string for printing to
8474  * text/json form.
8475  *
8476  * \return name of the statement as a string i.e. "LINEAR "
8477  *
8478  * \sa Ast::get_nmodl_name
8479  */
8480  std::string get_nmodl_name() const noexcept override { return "LINEAR "; }
8481 
8482  /**
8483  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8484  */
8485  std::shared_ptr<Ast> get_shared_ptr() override {
8486  return std::static_pointer_cast<LinearBlock>(shared_from_this());
8487  }
8488 
8489  /**
8490  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8491  */
8492  std::shared_ptr<const Ast> get_shared_ptr() const override {
8493  return std::static_pointer_cast<const LinearBlock>(shared_from_this());
8494  }
8495 
8496  /**
8497  * \brief Return associated token for the current ast node
8498  *
8499  * Not all ast nodes have token information. For example,
8500  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
8501  * solution of ODEs. In this case, we return nullptr to store in the
8502  * nmodl::symtab::SymbolTable.
8503  *
8504  * \return pointer to token if exist otherwise nullptr
8505  */
8506  const ModToken *get_token() const noexcept override { return token.get(); }
8507 
8508  /**
8509  * \brief Return associated symbol table for the current ast node
8510  *
8511  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8512  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8513  * and it can be accessed using this method.
8514  *
8515  * \return pointer to the symbol table
8516  *
8517  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8518  */
8519  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
8520 
8521  /**
8522  * \brief Return name of the node
8523  *
8524  * Some ast nodes have a member marked designated as node name. For example,
8525  * in case of this ast::Name has name designated as a
8526  * node name.
8527  *
8528  * @return name of the node as std::string
8529  *
8530  * \sa Ast::get_node_type_name
8531  */
8532  std::string get_node_name() const override;
8533 
8534  /**
8535  * \brief Getter for member variable \ref LinearBlock.name
8536  */
8537  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
8538 
8539  /**
8540  * \brief Getter for member variable \ref LinearBlock.solvefor
8541  */
8542  const NameVector &get_solvefor() const noexcept { return solvefor; }
8543 
8544  /**
8545  * \brief Getter for member variable \ref LinearBlock.statement_block
8546  */
8547  const std::shared_ptr<StatementBlock> &get_statement_block() const
8548  noexcept override {
8549  return statement_block;
8550  }
8551 
8552  /// \}
8553 
8554  /// \name Setters
8555  /// \{
8556 
8557  /**
8558  * \brief Set token for the current ast node
8559  */
8560  void set_token(const ModToken &tok) {
8561  token = std::make_shared<ModToken>(tok);
8562  }
8563 
8564  /**
8565  * \brief Set symbol table for the current ast node
8566  *
8567  * Top level, block scoped nodes store symbol table in the ast node.
8568  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8569  * for every node in the ast.
8570  *
8571  * \sa nmodl::visitor::SymtabVisitor
8572  */
8573  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
8574  symtab = newsymtab;
8575  }
8576 
8577  /**
8578  * \brief Setter for member variable \ref LinearBlock.name (rvalue reference)
8579  */
8580  void set_name(std::shared_ptr<Name> &&name);
8581 
8582  /**
8583  * \brief Setter for member variable \ref LinearBlock.name
8584  */
8585  void set_name(const std::shared_ptr<Name> &name);
8586 
8587  /**
8588  * \brief Setter for member variable \ref LinearBlock.solvefor (rvalue
8589  * reference)
8590  */
8591  void set_solvefor(NameVector &&solvefor);
8592 
8593  /**
8594  * \brief Setter for member variable \ref LinearBlock.solvefor
8595  */
8596  void set_solvefor(const NameVector &solvefor);
8597 
8598  /**
8599  * \brief Setter for member variable \ref LinearBlock.statement_block (rvalue
8600  * reference)
8601  */
8602  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
8603 
8604  /**
8605  * \brief Setter for member variable \ref LinearBlock.statement_block
8606  */
8607  void
8608  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
8609 
8610  /// \}
8611 
8612  /// \name Visitor
8613  /// \{
8614 
8615  /**
8616  * \brief visit children i.e. member variables of current node using provided
8617  * visitor
8618  *
8619  * Different nodes in the AST have different members (i.e. children). This
8620  * method recursively visits children using provided visitor.
8621  *
8622  * \param v Concrete visitor that will be used to recursively visit children
8623  *
8624  * \sa Ast::visit_children for example.
8625  */
8626  void visit_children(visitor::Visitor &v) override;
8627 
8628  /**
8629  * \brief accept (or visit) the current AST node using provided visitor
8630  *
8631  * Instead of visiting children of AST node, like Ast::visit_children,
8632  * accept allows to visit the current node itself using provided concrete
8633  * visitor.
8634  *
8635  * \param v Concrete visitor that will be used to recursively visit node
8636  *
8637  * \sa Ast::accept for example.
8638  */
8639  void accept(visitor::Visitor &v) override;
8640 
8641  /// \}
8642 
8643 private:
8644  /**
8645  * \brief Set this object as parent for all the children
8646  *
8647  * This should be called in every object (with children) constructor
8648  * to set parents. Since it is called only in the constructors it
8649  * should not be virtual to avoid ambiguities (issue #295).
8650  */
8651  void set_parent_in_children();
8652 };
8653 
8654 /** @} */ // end of ast_class
8655 
8656 } // namespace ast
8657 } // namespace nmodl
8658 #endif // !NMODL_AST_LINEAR_BLOCK_HPP
8659 #ifndef NMODL_AST_NON_LINEAR_BLOCK_HPP
8660 #define NMODL_AST_NON_LINEAR_BLOCK_HPP
8661 
8662 namespace nmodl {
8663 namespace ast {
8664 
8665 /**
8666  * @addtogroup ast_class
8667  * @ingroup ast
8668  * @{
8669  */
8670 
8671 /**
8672  * \brief Represents `NONLINEAR` block in the NMODL
8673  *
8674  *
8675  * A set of simultaneous equations can be specified in a `NONLINEAR` block.
8676  * Here is an example :
8677  *
8678  * \code{.mod}
8679  * NONLINEAR nonlin {
8680  * ~ s[0] = 1
8681  * ~ s[1] = 3
8682  * ~ s[2] + s[1] = s[0]
8683  * }
8684  * \endcode
8685  *
8686  */
8687 class NonLinearBlock : public Block {
8688 private:
8689  /// Name of the non-linear block
8690  std::shared_ptr<Name> name;
8691  /// Name of the integration method
8693  /// Block with statements vector
8694  std::shared_ptr<StatementBlock> statement_block;
8695  /// token with location information
8696  std::shared_ptr<ModToken> token;
8697  /// symbol table for a block
8698  symtab::SymbolTable *symtab = nullptr;
8699 
8700 public:
8701  /// \name Ctor & dtor
8702  /// \{
8703 
8704  explicit NonLinearBlock(Name *name, NameVector solvefor,
8705  StatementBlock *statement_block);
8706  explicit NonLinearBlock(
8707  const std::shared_ptr<Name> &name, const NameVector &solvefor,
8708  const std::shared_ptr<StatementBlock> &statement_block);
8709  NonLinearBlock(const NonLinearBlock &obj);
8710 
8711  virtual ~NonLinearBlock() = default;
8712 
8713  /// \}
8714 
8715  /**
8716  * \brief Check if the ast node is an instance of ast::NonLinearBlock
8717  * \return true as object is of type ast::NonLinearBlock
8718  */
8719  bool is_non_linear_block() const noexcept override { return true; }
8720 
8721  /**
8722  * \brief Return a copy of the current node
8723  *
8724  * Recursively make a new copy/clone of the current node including
8725  * all members and return a pointer to the node. This is used for
8726  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8727  * ast.
8728  *
8729  * @return pointer to the clone/copy of the current node
8730  */
8731  NonLinearBlock *clone() const override { return new NonLinearBlock(*this); }
8732 
8733  /// \name Getters
8734  /// \{
8735 
8736  /**
8737  * \brief Return type (ast::AstNodeType) of ast node
8738  *
8739  * Every node in the ast has a type defined in ast::AstNodeType and this
8740  * function is used to retrieve the same.
8741  *
8742  * \return ast node type i.e. ast::AstNodeType::NON_LINEAR_BLOCK
8743  *
8744  * \sa Ast::get_node_type_name
8745  */
8746  AstNodeType get_node_type() const noexcept override {
8748  }
8749 
8750  /**
8751  * \brief Return type (ast::AstNodeType) of ast node as std::string
8752  *
8753  * Every node in the ast has a type defined in ast::AstNodeType.
8754  * This type name can be returned as a std::string for printing
8755  * node to text/json form.
8756  *
8757  * \return name of the node type as a string i.e. "NonLinearBlock"
8758  *
8759  * \sa Ast::get_node_name
8760  */
8761  std::string get_node_type_name() const noexcept override {
8762  return "NonLinearBlock";
8763  }
8764 
8765  /**
8766  * \brief Return NMODL statement of ast node as std::string
8767  *
8768  * Every node is related to a special statement in the NMODL. This
8769  * statement can be returned as a std::string for printing to
8770  * text/json form.
8771  *
8772  * \return name of the statement as a string i.e. "NONLINEAR "
8773  *
8774  * \sa Ast::get_nmodl_name
8775  */
8776  std::string get_nmodl_name() const noexcept override { return "NONLINEAR "; }
8777 
8778  /**
8779  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8780  */
8781  std::shared_ptr<Ast> get_shared_ptr() override {
8782  return std::static_pointer_cast<NonLinearBlock>(shared_from_this());
8783  }
8784 
8785  /**
8786  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8787  */
8788  std::shared_ptr<const Ast> get_shared_ptr() const override {
8789  return std::static_pointer_cast<const NonLinearBlock>(shared_from_this());
8790  }
8791 
8792  /**
8793  * \brief Return associated token for the current ast node
8794  *
8795  * Not all ast nodes have token information. For example,
8796  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
8797  * solution of ODEs. In this case, we return nullptr to store in the
8798  * nmodl::symtab::SymbolTable.
8799  *
8800  * \return pointer to token if exist otherwise nullptr
8801  */
8802  const ModToken *get_token() const noexcept override { return token.get(); }
8803 
8804  /**
8805  * \brief Return associated symbol table for the current ast node
8806  *
8807  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8808  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8809  * and it can be accessed using this method.
8810  *
8811  * \return pointer to the symbol table
8812  *
8813  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8814  */
8815  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
8816 
8817  /**
8818  * \brief Return name of the node
8819  *
8820  * Some ast nodes have a member marked designated as node name. For example,
8821  * in case of this ast::Name has name designated as a
8822  * node name.
8823  *
8824  * @return name of the node as std::string
8825  *
8826  * \sa Ast::get_node_type_name
8827  */
8828  std::string get_node_name() const override;
8829 
8830  /**
8831  * \brief Getter for member variable \ref NonLinearBlock.name
8832  */
8833  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
8834 
8835  /**
8836  * \brief Getter for member variable \ref NonLinearBlock.solvefor
8837  */
8838  const NameVector &get_solvefor() const noexcept { return solvefor; }
8839 
8840  /**
8841  * \brief Getter for member variable \ref NonLinearBlock.statement_block
8842  */
8843  const std::shared_ptr<StatementBlock> &get_statement_block() const
8844  noexcept override {
8845  return statement_block;
8846  }
8847 
8848  /// \}
8849 
8850  /// \name Setters
8851  /// \{
8852 
8853  /**
8854  * \brief Set token for the current ast node
8855  */
8856  void set_token(const ModToken &tok) {
8857  token = std::make_shared<ModToken>(tok);
8858  }
8859 
8860  /**
8861  * \brief Set symbol table for the current ast node
8862  *
8863  * Top level, block scoped nodes store symbol table in the ast node.
8864  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8865  * for every node in the ast.
8866  *
8867  * \sa nmodl::visitor::SymtabVisitor
8868  */
8869  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
8870  symtab = newsymtab;
8871  }
8872 
8873  /**
8874  * \brief Setter for member variable \ref NonLinearBlock.name (rvalue
8875  * reference)
8876  */
8877  void set_name(std::shared_ptr<Name> &&name);
8878 
8879  /**
8880  * \brief Setter for member variable \ref NonLinearBlock.name
8881  */
8882  void set_name(const std::shared_ptr<Name> &name);
8883 
8884  /**
8885  * \brief Setter for member variable \ref NonLinearBlock.solvefor (rvalue
8886  * reference)
8887  */
8888  void set_solvefor(NameVector &&solvefor);
8889 
8890  /**
8891  * \brief Setter for member variable \ref NonLinearBlock.solvefor
8892  */
8893  void set_solvefor(const NameVector &solvefor);
8894 
8895  /**
8896  * \brief Setter for member variable \ref NonLinearBlock.statement_block
8897  * (rvalue reference)
8898  */
8899  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
8900 
8901  /**
8902  * \brief Setter for member variable \ref NonLinearBlock.statement_block
8903  */
8904  void
8905  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
8906 
8907  /// \}
8908 
8909  /// \name Visitor
8910  /// \{
8911 
8912  /**
8913  * \brief visit children i.e. member variables of current node using provided
8914  * visitor
8915  *
8916  * Different nodes in the AST have different members (i.e. children). This
8917  * method recursively visits children using provided visitor.
8918  *
8919  * \param v Concrete visitor that will be used to recursively visit children
8920  *
8921  * \sa Ast::visit_children for example.
8922  */
8923  void visit_children(visitor::Visitor &v) override;
8924 
8925  /**
8926  * \brief accept (or visit) the current AST node using provided visitor
8927  *
8928  * Instead of visiting children of AST node, like Ast::visit_children,
8929  * accept allows to visit the current node itself using provided concrete
8930  * visitor.
8931  *
8932  * \param v Concrete visitor that will be used to recursively visit node
8933  *
8934  * \sa Ast::accept for example.
8935  */
8936  void accept(visitor::Visitor &v) override;
8937 
8938  /// \}
8939 
8940 private:
8941  /**
8942  * \brief Set this object as parent for all the children
8943  *
8944  * This should be called in every object (with children) constructor
8945  * to set parents. Since it is called only in the constructors it
8946  * should not be virtual to avoid ambiguities (issue #295).
8947  */
8948  void set_parent_in_children();
8949 };
8950 
8951 /** @} */ // end of ast_class
8952 
8953 } // namespace ast
8954 } // namespace nmodl
8955 #endif // !NMODL_AST_NON_LINEAR_BLOCK_HPP
8956 #ifndef NMODL_AST_DISCRETE_BLOCK_HPP
8957 #define NMODL_AST_DISCRETE_BLOCK_HPP
8958 
8959 namespace nmodl {
8960 namespace ast {
8961 
8962 /**
8963  * @addtogroup ast_class
8964  * @ingroup ast
8965  * @{
8966  */
8967 
8968 /**
8969  * \brief TODO
8970  *
8971  *
8972  */
8973 class DiscreteBlock : public Block {
8974 private:
8975  /// Name of the discrete block
8976  std::shared_ptr<Name> name;
8977  /// Block with statements vector
8978  std::shared_ptr<StatementBlock> statement_block;
8979  /// token with location information
8980  std::shared_ptr<ModToken> token;
8981  /// symbol table for a block
8982  symtab::SymbolTable *symtab = nullptr;
8983 
8984 public:
8985  /// \name Ctor & dtor
8986  /// \{
8987 
8988  explicit DiscreteBlock(Name *name, StatementBlock *statement_block);
8989  explicit DiscreteBlock(
8990  const std::shared_ptr<Name> &name,
8991  const std::shared_ptr<StatementBlock> &statement_block);
8992  DiscreteBlock(const DiscreteBlock &obj);
8993 
8994  virtual ~DiscreteBlock() = default;
8995 
8996  /// \}
8997 
8998  /**
8999  * \brief Check if the ast node is an instance of ast::DiscreteBlock
9000  * \return true as object is of type ast::DiscreteBlock
9001  */
9002  bool is_discrete_block() const noexcept override { return true; }
9003 
9004  /**
9005  * \brief Return a copy of the current node
9006  *
9007  * Recursively make a new copy/clone of the current node including
9008  * all members and return a pointer to the node. This is used for
9009  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9010  * ast.
9011  *
9012  * @return pointer to the clone/copy of the current node
9013  */
9014  DiscreteBlock *clone() const override { return new DiscreteBlock(*this); }
9015 
9016  /// \name Getters
9017  /// \{
9018 
9019  /**
9020  * \brief Return type (ast::AstNodeType) of ast node
9021  *
9022  * Every node in the ast has a type defined in ast::AstNodeType and this
9023  * function is used to retrieve the same.
9024  *
9025  * \return ast node type i.e. ast::AstNodeType::DISCRETE_BLOCK
9026  *
9027  * \sa Ast::get_node_type_name
9028  */
9029  AstNodeType get_node_type() const noexcept override {
9031  }
9032 
9033  /**
9034  * \brief Return type (ast::AstNodeType) of ast node as std::string
9035  *
9036  * Every node in the ast has a type defined in ast::AstNodeType.
9037  * This type name can be returned as a std::string for printing
9038  * node to text/json form.
9039  *
9040  * \return name of the node type as a string i.e. "DiscreteBlock"
9041  *
9042  * \sa Ast::get_node_name
9043  */
9044  std::string get_node_type_name() const noexcept override {
9045  return "DiscreteBlock";
9046  }
9047 
9048  /**
9049  * \brief Return NMODL statement of ast node as std::string
9050  *
9051  * Every node is related to a special statement in the NMODL. This
9052  * statement can be returned as a std::string for printing to
9053  * text/json form.
9054  *
9055  * \return name of the statement as a string i.e. "DISCRETE "
9056  *
9057  * \sa Ast::get_nmodl_name
9058  */
9059  std::string get_nmodl_name() const noexcept override { return "DISCRETE "; }
9060 
9061  /**
9062  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9063  */
9064  std::shared_ptr<Ast> get_shared_ptr() override {
9065  return std::static_pointer_cast<DiscreteBlock>(shared_from_this());
9066  }
9067 
9068  /**
9069  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9070  */
9071  std::shared_ptr<const Ast> get_shared_ptr() const override {
9072  return std::static_pointer_cast<const DiscreteBlock>(shared_from_this());
9073  }
9074 
9075  /**
9076  * \brief Return associated token for the current ast node
9077  *
9078  * Not all ast nodes have token information. For example,
9079  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
9080  * solution of ODEs. In this case, we return nullptr to store in the
9081  * nmodl::symtab::SymbolTable.
9082  *
9083  * \return pointer to token if exist otherwise nullptr
9084  */
9085  const ModToken *get_token() const noexcept override { return token.get(); }
9086 
9087  /**
9088  * \brief Return associated symbol table for the current ast node
9089  *
9090  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9091  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9092  * and it can be accessed using this method.
9093  *
9094  * \return pointer to the symbol table
9095  *
9096  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9097  */
9098  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
9099 
9100  /**
9101  * \brief Return name of the node
9102  *
9103  * Some ast nodes have a member marked designated as node name. For example,
9104  * in case of this ast::Name has name designated as a
9105  * node name.
9106  *
9107  * @return name of the node as std::string
9108  *
9109  * \sa Ast::get_node_type_name
9110  */
9111  std::string get_node_name() const override;
9112 
9113  /**
9114  * \brief Getter for member variable \ref DiscreteBlock.name
9115  */
9116  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
9117 
9118  /**
9119  * \brief Getter for member variable \ref DiscreteBlock.statement_block
9120  */
9121  const std::shared_ptr<StatementBlock> &get_statement_block() const
9122  noexcept override {
9123  return statement_block;
9124  }
9125 
9126  /// \}
9127 
9128  /// \name Setters
9129  /// \{
9130 
9131  /**
9132  * \brief Set token for the current ast node
9133  */
9134  void set_token(const ModToken &tok) {
9135  token = std::make_shared<ModToken>(tok);
9136  }
9137 
9138  /**
9139  * \brief Set symbol table for the current ast node
9140  *
9141  * Top level, block scoped nodes store symbol table in the ast node.
9142  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9143  * for every node in the ast.
9144  *
9145  * \sa nmodl::visitor::SymtabVisitor
9146  */
9147  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
9148  symtab = newsymtab;
9149  }
9150 
9151  /**
9152  * \brief Setter for member variable \ref DiscreteBlock.name (rvalue
9153  * reference)
9154  */
9155  void set_name(std::shared_ptr<Name> &&name);
9156 
9157  /**
9158  * \brief Setter for member variable \ref DiscreteBlock.name
9159  */
9160  void set_name(const std::shared_ptr<Name> &name);
9161 
9162  /**
9163  * \brief Setter for member variable \ref DiscreteBlock.statement_block
9164  * (rvalue reference)
9165  */
9166  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
9167 
9168  /**
9169  * \brief Setter for member variable \ref DiscreteBlock.statement_block
9170  */
9171  void
9172  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
9173 
9174  /// \}
9175 
9176  /// \name Visitor
9177  /// \{
9178 
9179  /**
9180  * \brief visit children i.e. member variables of current node using provided
9181  * visitor
9182  *
9183  * Different nodes in the AST have different members (i.e. children). This
9184  * method recursively visits children using provided visitor.
9185  *
9186  * \param v Concrete visitor that will be used to recursively visit children
9187  *
9188  * \sa Ast::visit_children for example.
9189  */
9190  void visit_children(visitor::Visitor &v) override;
9191 
9192  /**
9193  * \brief accept (or visit) the current AST node using provided visitor
9194  *
9195  * Instead of visiting children of AST node, like Ast::visit_children,
9196  * accept allows to visit the current node itself using provided concrete
9197  * visitor.
9198  *
9199  * \param v Concrete visitor that will be used to recursively visit node
9200  *
9201  * \sa Ast::accept for example.
9202  */
9203  void accept(visitor::Visitor &v) override;
9204 
9205  /// \}
9206 
9207 private:
9208  /**
9209  * \brief Set this object as parent for all the children
9210  *
9211  * This should be called in every object (with children) constructor
9212  * to set parents. Since it is called only in the constructors it
9213  * should not be virtual to avoid ambiguities (issue #295).
9214  */
9215  void set_parent_in_children();
9216 };
9217 
9218 /** @} */ // end of ast_class
9219 
9220 } // namespace ast
9221 } // namespace nmodl
9222 #endif // !NMODL_AST_DISCRETE_BLOCK_HPP
9223 #ifndef NMODL_AST_PARTIAL_BLOCK_HPP
9224 #define NMODL_AST_PARTIAL_BLOCK_HPP
9225 
9226 namespace nmodl {
9227 namespace ast {
9228 
9229 /**
9230  * @addtogroup ast_class
9231  * @ingroup ast
9232  * @{
9233  */
9234 
9235 /**
9236  * \brief TODO
9237  *
9238  *
9239  */
9240 class PartialBlock : public Block {
9241 private:
9242  /// Name of the partial block
9243  std::shared_ptr<Name> name;
9244  /// Block with statements vector
9245  std::shared_ptr<StatementBlock> statement_block;
9246  /// token with location information
9247  std::shared_ptr<ModToken> token;
9248  /// symbol table for a block
9249  symtab::SymbolTable *symtab = nullptr;
9250 
9251 public:
9252  /// \name Ctor & dtor
9253  /// \{
9254 
9255  explicit PartialBlock(Name *name, StatementBlock *statement_block);
9256  explicit PartialBlock(const std::shared_ptr<Name> &name,
9257  const std::shared_ptr<StatementBlock> &statement_block);
9258  PartialBlock(const PartialBlock &obj);
9259 
9260  virtual ~PartialBlock() = default;
9261 
9262  /// \}
9263 
9264  /**
9265  * \brief Check if the ast node is an instance of ast::PartialBlock
9266  * \return true as object is of type ast::PartialBlock
9267  */
9268  bool is_partial_block() const noexcept override { return true; }
9269 
9270  /**
9271  * \brief Return a copy of the current node
9272  *
9273  * Recursively make a new copy/clone of the current node including
9274  * all members and return a pointer to the node. This is used for
9275  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9276  * ast.
9277  *
9278  * @return pointer to the clone/copy of the current node
9279  */
9280  PartialBlock *clone() const override { return new PartialBlock(*this); }
9281 
9282  /// \name Getters
9283  /// \{
9284 
9285  /**
9286  * \brief Return type (ast::AstNodeType) of ast node
9287  *
9288  * Every node in the ast has a type defined in ast::AstNodeType and this
9289  * function is used to retrieve the same.
9290  *
9291  * \return ast node type i.e. ast::AstNodeType::PARTIAL_BLOCK
9292  *
9293  * \sa Ast::get_node_type_name
9294  */
9295  AstNodeType get_node_type() const noexcept override {
9297  }
9298 
9299  /**
9300  * \brief Return type (ast::AstNodeType) of ast node as std::string
9301  *
9302  * Every node in the ast has a type defined in ast::AstNodeType.
9303  * This type name can be returned as a std::string for printing
9304  * node to text/json form.
9305  *
9306  * \return name of the node type as a string i.e. "PartialBlock"
9307  *
9308  * \sa Ast::get_node_name
9309  */
9310  std::string get_node_type_name() const noexcept override {
9311  return "PartialBlock";
9312  }
9313 
9314  /**
9315  * \brief Return NMODL statement of ast node as std::string
9316  *
9317  * Every node is related to a special statement in the NMODL. This
9318  * statement can be returned as a std::string for printing to
9319  * text/json form.
9320  *
9321  * \return name of the statement as a string i.e. "PARTIAL "
9322  *
9323  * \sa Ast::get_nmodl_name
9324  */
9325  std::string get_nmodl_name() const noexcept override { return "PARTIAL "; }
9326 
9327  /**
9328  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9329  */
9330  std::shared_ptr<Ast> get_shared_ptr() override {
9331  return std::static_pointer_cast<PartialBlock>(shared_from_this());
9332  }
9333 
9334  /**
9335  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9336  */
9337  std::shared_ptr<const Ast> get_shared_ptr() const override {
9338  return std::static_pointer_cast<const PartialBlock>(shared_from_this());
9339  }
9340 
9341  /**
9342  * \brief Return associated token for the current ast node
9343  *
9344  * Not all ast nodes have token information. For example,
9345  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
9346  * solution of ODEs. In this case, we return nullptr to store in the
9347  * nmodl::symtab::SymbolTable.
9348  *
9349  * \return pointer to token if exist otherwise nullptr
9350  */
9351  const ModToken *get_token() const noexcept override { return token.get(); }
9352 
9353  /**
9354  * \brief Return associated symbol table for the current ast node
9355  *
9356  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9357  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9358  * and it can be accessed using this method.
9359  *
9360  * \return pointer to the symbol table
9361  *
9362  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9363  */
9364  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
9365 
9366  /**
9367  * \brief Return name of the node
9368  *
9369  * Some ast nodes have a member marked designated as node name. For example,
9370  * in case of this ast::Name has name designated as a
9371  * node name.
9372  *
9373  * @return name of the node as std::string
9374  *
9375  * \sa Ast::get_node_type_name
9376  */
9377  std::string get_node_name() const override;
9378 
9379  /**
9380  * \brief Getter for member variable \ref PartialBlock.name
9381  */
9382  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
9383 
9384  /**
9385  * \brief Getter for member variable \ref PartialBlock.statement_block
9386  */
9387  const std::shared_ptr<StatementBlock> &get_statement_block() const
9388  noexcept override {
9389  return statement_block;
9390  }
9391 
9392  /// \}
9393 
9394  /// \name Setters
9395  /// \{
9396 
9397  /**
9398  * \brief Set token for the current ast node
9399  */
9400  void set_token(const ModToken &tok) {
9401  token = std::make_shared<ModToken>(tok);
9402  }
9403 
9404  /**
9405  * \brief Set symbol table for the current ast node
9406  *
9407  * Top level, block scoped nodes store symbol table in the ast node.
9408  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9409  * for every node in the ast.
9410  *
9411  * \sa nmodl::visitor::SymtabVisitor
9412  */
9413  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
9414  symtab = newsymtab;
9415  }
9416 
9417  /**
9418  * \brief Setter for member variable \ref PartialBlock.name (rvalue reference)
9419  */
9420  void set_name(std::shared_ptr<Name> &&name);
9421 
9422  /**
9423  * \brief Setter for member variable \ref PartialBlock.name
9424  */
9425  void set_name(const std::shared_ptr<Name> &name);
9426 
9427  /**
9428  * \brief Setter for member variable \ref PartialBlock.statement_block (rvalue
9429  * reference)
9430  */
9431  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
9432 
9433  /**
9434  * \brief Setter for member variable \ref PartialBlock.statement_block
9435  */
9436  void
9437  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
9438 
9439  /// \}
9440 
9441  /// \name Visitor
9442  /// \{
9443 
9444  /**
9445  * \brief visit children i.e. member variables of current node using provided
9446  * visitor
9447  *
9448  * Different nodes in the AST have different members (i.e. children). This
9449  * method recursively visits children using provided visitor.
9450  *
9451  * \param v Concrete visitor that will be used to recursively visit children
9452  *
9453  * \sa Ast::visit_children for example.
9454  */
9455  void visit_children(visitor::Visitor &v) override;
9456 
9457  /**
9458  * \brief accept (or visit) the current AST node using provided visitor
9459  *
9460  * Instead of visiting children of AST node, like Ast::visit_children,
9461  * accept allows to visit the current node itself using provided concrete
9462  * visitor.
9463  *
9464  * \param v Concrete visitor that will be used to recursively visit node
9465  *
9466  * \sa Ast::accept for example.
9467  */
9468  void accept(visitor::Visitor &v) override;
9469 
9470  /// \}
9471 
9472 private:
9473  /**
9474  * \brief Set this object as parent for all the children
9475  *
9476  * This should be called in every object (with children) constructor
9477  * to set parents. Since it is called only in the constructors it
9478  * should not be virtual to avoid ambiguities (issue #295).
9479  */
9480  void set_parent_in_children();
9481 };
9482 
9483 /** @} */ // end of ast_class
9484 
9485 } // namespace ast
9486 } // namespace nmodl
9487 #endif // !NMODL_AST_PARTIAL_BLOCK_HPP
9488 #ifndef NMODL_AST_FUNCTION_TABLE_BLOCK_HPP
9489 #define NMODL_AST_FUNCTION_TABLE_BLOCK_HPP
9490 
9491 namespace nmodl {
9492 namespace ast {
9493 
9494 /**
9495  * @addtogroup ast_class
9496  * @ingroup ast
9497  * @{
9498  */
9499 
9500 /**
9501  * \brief TODO
9502  *
9503  *
9504  */
9505 class FunctionTableBlock : public Block {
9506 private:
9507  /// Name of the function table block
9508  std::shared_ptr<Name> name;
9509  /// Vector of the parameters
9511  /// Unit if specified
9512  std::shared_ptr<Unit> unit;
9513  /// token with location information
9514  std::shared_ptr<ModToken> token;
9515  /// symbol table for a block
9516  symtab::SymbolTable *symtab = nullptr;
9517 
9518 public:
9519  /// \name Ctor & dtor
9520  /// \{
9521 
9522  explicit FunctionTableBlock(Name *name, ArgumentVector parameters,
9523  Unit *unit);
9524  explicit FunctionTableBlock(const std::shared_ptr<Name> &name,
9525  const ArgumentVector &parameters,
9526  const std::shared_ptr<Unit> &unit);
9528 
9529  virtual ~FunctionTableBlock() = default;
9530 
9531  /// \}
9532 
9533  /**
9534  * \brief Check if the ast node is an instance of ast::FunctionTableBlock
9535  * \return true as object is of type ast::FunctionTableBlock
9536  */
9537  bool is_function_table_block() const noexcept override { return true; }
9538 
9539  /**
9540  * \brief Return a copy of the current node
9541  *
9542  * Recursively make a new copy/clone of the current node including
9543  * all members and return a pointer to the node. This is used for
9544  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9545  * ast.
9546  *
9547  * @return pointer to the clone/copy of the current node
9548  */
9549  FunctionTableBlock *clone() const override {
9550  return new FunctionTableBlock(*this);
9551  }
9552 
9553  /// \name Getters
9554  /// \{
9555 
9556  /**
9557  * \brief Return type (ast::AstNodeType) of ast node
9558  *
9559  * Every node in the ast has a type defined in ast::AstNodeType and this
9560  * function is used to retrieve the same.
9561  *
9562  * \return ast node type i.e. ast::AstNodeType::FUNCTION_TABLE_BLOCK
9563  *
9564  * \sa Ast::get_node_type_name
9565  */
9566  AstNodeType get_node_type() const noexcept override {
9568  }
9569 
9570  /**
9571  * \brief Return type (ast::AstNodeType) of ast node as std::string
9572  *
9573  * Every node in the ast has a type defined in ast::AstNodeType.
9574  * This type name can be returned as a std::string for printing
9575  * node to text/json form.
9576  *
9577  * \return name of the node type as a string i.e. "FunctionTableBlock"
9578  *
9579  * \sa Ast::get_node_name
9580  */
9581  std::string get_node_type_name() const noexcept override {
9582  return "FunctionTableBlock";
9583  }
9584 
9585  /**
9586  * \brief Return NMODL statement of ast node as std::string
9587  *
9588  * Every node is related to a special statement in the NMODL. This
9589  * statement can be returned as a std::string for printing to
9590  * text/json form.
9591  *
9592  * \return name of the statement as a string i.e. "FUNCTION_TABLE "
9593  *
9594  * \sa Ast::get_nmodl_name
9595  */
9596  std::string get_nmodl_name() const noexcept override {
9597  return "FUNCTION_TABLE ";
9598  }
9599 
9600  /**
9601  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9602  */
9603  std::shared_ptr<Ast> get_shared_ptr() override {
9604  return std::static_pointer_cast<FunctionTableBlock>(shared_from_this());
9605  }
9606 
9607  /**
9608  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9609  */
9610  std::shared_ptr<const Ast> get_shared_ptr() const override {
9611  return std::static_pointer_cast<const FunctionTableBlock>(
9612  shared_from_this());
9613  }
9614 
9615  /**
9616  * \brief Return associated token for the current ast node
9617  *
9618  * Not all ast nodes have token information. For example,
9619  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
9620  * solution of ODEs. In this case, we return nullptr to store in the
9621  * nmodl::symtab::SymbolTable.
9622  *
9623  * \return pointer to token if exist otherwise nullptr
9624  */
9625  const ModToken *get_token() const noexcept override { return token.get(); }
9626 
9627  /**
9628  * \brief Return associated symbol table for the current ast node
9629  *
9630  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9631  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9632  * and it can be accessed using this method.
9633  *
9634  * \return pointer to the symbol table
9635  *
9636  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9637  */
9638  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
9639 
9640  /**
9641  * \brief Return name of the node
9642  *
9643  * Some ast nodes have a member marked designated as node name. For example,
9644  * in case of this ast::Name has name designated as a
9645  * node name.
9646  *
9647  * @return name of the node as std::string
9648  *
9649  * \sa Ast::get_node_type_name
9650  */
9651  std::string get_node_name() const override;
9652 
9653  /**
9654  * \brief Getter for member variable \ref FunctionTableBlock.name
9655  */
9656  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
9657 
9658  /**
9659  * \brief Getter for member variable \ref FunctionTableBlock.parameters
9660  */
9661  const ArgumentVector &get_parameters() const noexcept override {
9662  return parameters;
9663  }
9664 
9665  /**
9666  * \brief Getter for member variable \ref FunctionTableBlock.unit
9667  */
9668  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
9669 
9670  /// \}
9671 
9672  /// \name Setters
9673  /// \{
9674 
9675  /**
9676  * \brief Set token for the current ast node
9677  */
9678  void set_token(const ModToken &tok) {
9679  token = std::make_shared<ModToken>(tok);
9680  }
9681 
9682  /**
9683  * \brief Set symbol table for the current ast node
9684  *
9685  * Top level, block scoped nodes store symbol table in the ast node.
9686  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9687  * for every node in the ast.
9688  *
9689  * \sa nmodl::visitor::SymtabVisitor
9690  */
9691  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
9692  symtab = newsymtab;
9693  }
9694 
9695  /**
9696  * \brief Setter for member variable \ref FunctionTableBlock.name (rvalue
9697  * reference)
9698  */
9699  void set_name(std::shared_ptr<Name> &&name);
9700 
9701  /**
9702  * \brief Setter for member variable \ref FunctionTableBlock.name
9703  */
9704  void set_name(const std::shared_ptr<Name> &name);
9705 
9706  /**
9707  * \brief Setter for member variable \ref FunctionTableBlock.parameters
9708  * (rvalue reference)
9709  */
9710  void set_parameters(ArgumentVector &&parameters);
9711 
9712  /**
9713  * \brief Setter for member variable \ref FunctionTableBlock.parameters
9714  */
9715  void set_parameters(const ArgumentVector &parameters);
9716 
9717  /**
9718  * \brief Setter for member variable \ref FunctionTableBlock.unit (rvalue
9719  * reference)
9720  */
9721  void set_unit(std::shared_ptr<Unit> &&unit);
9722 
9723  /**
9724  * \brief Setter for member variable \ref FunctionTableBlock.unit
9725  */
9726  void set_unit(const std::shared_ptr<Unit> &unit);
9727 
9728  /// \}
9729 
9730  /// \name Visitor
9731  /// \{
9732 
9733  /**
9734  * \brief visit children i.e. member variables of current node using provided
9735  * visitor
9736  *
9737  * Different nodes in the AST have different members (i.e. children). This
9738  * method recursively visits children using provided visitor.
9739  *
9740  * \param v Concrete visitor that will be used to recursively visit children
9741  *
9742  * \sa Ast::visit_children for example.
9743  */
9744  void visit_children(visitor::Visitor &v) override;
9745 
9746  /**
9747  * \brief accept (or visit) the current AST node using provided visitor
9748  *
9749  * Instead of visiting children of AST node, like Ast::visit_children,
9750  * accept allows to visit the current node itself using provided concrete
9751  * visitor.
9752  *
9753  * \param v Concrete visitor that will be used to recursively visit node
9754  *
9755  * \sa Ast::accept for example.
9756  */
9757  void accept(visitor::Visitor &v) override;
9758 
9759  /// \}
9760 
9761 private:
9762  /**
9763  * \brief Set this object as parent for all the children
9764  *
9765  * This should be called in every object (with children) constructor
9766  * to set parents. Since it is called only in the constructors it
9767  * should not be virtual to avoid ambiguities (issue #295).
9768  */
9769  void set_parent_in_children();
9770 };
9771 
9772 /** @} */ // end of ast_class
9773 
9774 } // namespace ast
9775 } // namespace nmodl
9776 #endif // !NMODL_AST_FUNCTION_TABLE_BLOCK_HPP
9777 #ifndef NMODL_AST_FUNCTION_BLOCK_HPP
9778 #define NMODL_AST_FUNCTION_BLOCK_HPP
9779 
9780 namespace nmodl {
9781 namespace ast {
9782 
9783 /**
9784  * @addtogroup ast_class
9785  * @ingroup ast
9786  * @{
9787  */
9788 
9789 /**
9790  * \brief TODO
9791  *
9792  *
9793  */
9794 class FunctionBlock : public Block {
9795 private:
9796  /// Name of the function
9797  std::shared_ptr<Name> name;
9798  /// Vector of the parameters
9800  /// Unit if specified
9801  std::shared_ptr<Unit> unit;
9802  /// Block with statements vector
9803  std::shared_ptr<StatementBlock> statement_block;
9804  /// token with location information
9805  std::shared_ptr<ModToken> token;
9806  /// symbol table for a block
9807  symtab::SymbolTable *symtab = nullptr;
9808 
9809 public:
9810  /// \name Ctor & dtor
9811  /// \{
9812 
9813  explicit FunctionBlock(Name *name, ArgumentVector parameters, Unit *unit,
9814  StatementBlock *statement_block);
9815  explicit FunctionBlock(
9816  const std::shared_ptr<Name> &name, const ArgumentVector &parameters,
9817  const std::shared_ptr<Unit> &unit,
9818  const std::shared_ptr<StatementBlock> &statement_block);
9819  FunctionBlock(const FunctionBlock &obj);
9820 
9821  virtual ~FunctionBlock() = default;
9822 
9823  /// \}
9824 
9825  /**
9826  * \brief Check if the ast node is an instance of ast::FunctionBlock
9827  * \return true as object is of type ast::FunctionBlock
9828  */
9829  bool is_function_block() const noexcept override { return true; }
9830 
9831  /**
9832  * \brief Return a copy of the current node
9833  *
9834  * Recursively make a new copy/clone of the current node including
9835  * all members and return a pointer to the node. This is used for
9836  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9837  * ast.
9838  *
9839  * @return pointer to the clone/copy of the current node
9840  */
9841  FunctionBlock *clone() const override { return new FunctionBlock(*this); }
9842 
9843  /// \name Getters
9844  /// \{
9845 
9846  /**
9847  * \brief Return type (ast::AstNodeType) of ast node
9848  *
9849  * Every node in the ast has a type defined in ast::AstNodeType and this
9850  * function is used to retrieve the same.
9851  *
9852  * \return ast node type i.e. ast::AstNodeType::FUNCTION_BLOCK
9853  *
9854  * \sa Ast::get_node_type_name
9855  */
9856  AstNodeType get_node_type() const noexcept override {
9858  }
9859 
9860  /**
9861  * \brief Return type (ast::AstNodeType) of ast node as std::string
9862  *
9863  * Every node in the ast has a type defined in ast::AstNodeType.
9864  * This type name can be returned as a std::string for printing
9865  * node to text/json form.
9866  *
9867  * \return name of the node type as a string i.e. "FunctionBlock"
9868  *
9869  * \sa Ast::get_node_name
9870  */
9871  std::string get_node_type_name() const noexcept override {
9872  return "FunctionBlock";
9873  }
9874 
9875  /**
9876  * \brief Return NMODL statement of ast node as std::string
9877  *
9878  * Every node is related to a special statement in the NMODL. This
9879  * statement can be returned as a std::string for printing to
9880  * text/json form.
9881  *
9882  * \return name of the statement as a string i.e. "FUNCTION "
9883  *
9884  * \sa Ast::get_nmodl_name
9885  */
9886  std::string get_nmodl_name() const noexcept override { return "FUNCTION "; }
9887 
9888  /**
9889  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9890  */
9891  std::shared_ptr<Ast> get_shared_ptr() override {
9892  return std::static_pointer_cast<FunctionBlock>(shared_from_this());
9893  }
9894 
9895  /**
9896  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9897  */
9898  std::shared_ptr<const Ast> get_shared_ptr() const override {
9899  return std::static_pointer_cast<const FunctionBlock>(shared_from_this());
9900  }
9901 
9902  /**
9903  * \brief Return associated token for the current ast node
9904  *
9905  * Not all ast nodes have token information. For example,
9906  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
9907  * solution of ODEs. In this case, we return nullptr to store in the
9908  * nmodl::symtab::SymbolTable.
9909  *
9910  * \return pointer to token if exist otherwise nullptr
9911  */
9912  const ModToken *get_token() const noexcept override { return token.get(); }
9913 
9914  /**
9915  * \brief Return associated symbol table for the current ast node
9916  *
9917  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9918  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9919  * and it can be accessed using this method.
9920  *
9921  * \return pointer to the symbol table
9922  *
9923  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9924  */
9925  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
9926 
9927  /**
9928  * \brief Return name of the node
9929  *
9930  * Some ast nodes have a member marked designated as node name. For example,
9931  * in case of this ast::Name has name designated as a
9932  * node name.
9933  *
9934  * @return name of the node as std::string
9935  *
9936  * \sa Ast::get_node_type_name
9937  */
9938  std::string get_node_name() const override;
9939 
9940  /**
9941  * \brief Getter for member variable \ref FunctionBlock.name
9942  */
9943  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
9944 
9945  /**
9946  * \brief Getter for member variable \ref FunctionBlock.parameters
9947  */
9948  const ArgumentVector &get_parameters() const noexcept override {
9949  return parameters;
9950  }
9951 
9952  /**
9953  * \brief Getter for member variable \ref FunctionBlock.unit
9954  */
9955  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
9956 
9957  /**
9958  * \brief Getter for member variable \ref FunctionBlock.statement_block
9959  */
9960  const std::shared_ptr<StatementBlock> &get_statement_block() const
9961  noexcept override {
9962  return statement_block;
9963  }
9964 
9965  /// \}
9966 
9967  /// \name Setters
9968  /// \{
9969 
9970  /**
9971  * \brief Set token for the current ast node
9972  */
9973  void set_token(const ModToken &tok) {
9974  token = std::make_shared<ModToken>(tok);
9975  }
9976 
9977  /**
9978  * \brief Set symbol table for the current ast node
9979  *
9980  * Top level, block scoped nodes store symbol table in the ast node.
9981  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9982  * for every node in the ast.
9983  *
9984  * \sa nmodl::visitor::SymtabVisitor
9985  */
9986  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
9987  symtab = newsymtab;
9988  }
9989 
9990  /**
9991  * \brief Setter for member variable \ref FunctionBlock.name (rvalue
9992  * reference)
9993  */
9994  void set_name(std::shared_ptr<Name> &&name);
9995 
9996  /**
9997  * \brief Setter for member variable \ref FunctionBlock.name
9998  */
9999  void set_name(const std::shared_ptr<Name> &name);
10000 
10001  /**
10002  * \brief Setter for member variable \ref FunctionBlock.parameters (rvalue
10003  * reference)
10004  */
10005  void set_parameters(ArgumentVector &&parameters);
10006 
10007  /**
10008  * \brief Setter for member variable \ref FunctionBlock.parameters
10009  */
10010  void set_parameters(const ArgumentVector &parameters);
10011 
10012  /**
10013  * \brief Setter for member variable \ref FunctionBlock.unit (rvalue
10014  * reference)
10015  */
10016  void set_unit(std::shared_ptr<Unit> &&unit);
10017 
10018  /**
10019  * \brief Setter for member variable \ref FunctionBlock.unit
10020  */
10021  void set_unit(const std::shared_ptr<Unit> &unit);
10022 
10023  /**
10024  * \brief Setter for member variable \ref FunctionBlock.statement_block
10025  * (rvalue reference)
10026  */
10027  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
10028 
10029  /**
10030  * \brief Setter for member variable \ref FunctionBlock.statement_block
10031  */
10032  void
10033  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
10034 
10035  /// \}
10036 
10037  /// \name Visitor
10038  /// \{
10039 
10040  /**
10041  * \brief visit children i.e. member variables of current node using provided
10042  * visitor
10043  *
10044  * Different nodes in the AST have different members (i.e. children). This
10045  * method recursively visits children using provided visitor.
10046  *
10047  * \param v Concrete visitor that will be used to recursively visit children
10048  *
10049  * \sa Ast::visit_children for example.
10050  */
10051  void visit_children(visitor::Visitor &v) override;
10052 
10053  /**
10054  * \brief accept (or visit) the current AST node using provided visitor
10055  *
10056  * Instead of visiting children of AST node, like Ast::visit_children,
10057  * accept allows to visit the current node itself using provided concrete
10058  * visitor.
10059  *
10060  * \param v Concrete visitor that will be used to recursively visit node
10061  *
10062  * \sa Ast::accept for example.
10063  */
10064  void accept(visitor::Visitor &v) override;
10065 
10066  /// \}
10067 
10068 private:
10069  /**
10070  * \brief Set this object as parent for all the children
10071  *
10072  * This should be called in every object (with children) constructor
10073  * to set parents. Since it is called only in the constructors it
10074  * should not be virtual to avoid ambiguities (issue #295).
10075  */
10076  void set_parent_in_children();
10077 };
10078 
10079 /** @} */ // end of ast_class
10080 
10081 } // namespace ast
10082 } // namespace nmodl
10083 #endif // !NMODL_AST_FUNCTION_BLOCK_HPP
10084 #ifndef NMODL_AST_PROCEDURE_BLOCK_HPP
10085 #define NMODL_AST_PROCEDURE_BLOCK_HPP
10086 
10087 namespace nmodl {
10088 namespace ast {
10089 
10090 /**
10091  * @addtogroup ast_class
10092  * @ingroup ast
10093  * @{
10094  */
10095 
10096 /**
10097  * \brief TODO
10098  *
10099  *
10100  */
10101 class ProcedureBlock : public Block {
10102 private:
10103  /// Name of the procedure
10104  std::shared_ptr<Name> name;
10105  /// Vector of the parameters
10107  /// Unit if specified
10108  std::shared_ptr<Unit> unit;
10109  /// Block with statements vector
10110  std::shared_ptr<StatementBlock> statement_block;
10111  /// token with location information
10112  std::shared_ptr<ModToken> token;
10113  /// symbol table for a block
10114  symtab::SymbolTable *symtab = nullptr;
10115 
10116 public:
10117  /// \name Ctor & dtor
10118  /// \{
10119 
10120  explicit ProcedureBlock(Name *name, ArgumentVector parameters, Unit *unit,
10121  StatementBlock *statement_block);
10122  explicit ProcedureBlock(
10123  const std::shared_ptr<Name> &name, const ArgumentVector &parameters,
10124  const std::shared_ptr<Unit> &unit,
10125  const std::shared_ptr<StatementBlock> &statement_block);
10126  ProcedureBlock(const ProcedureBlock &obj);
10127 
10128  virtual ~ProcedureBlock() = default;
10129 
10130  /// \}
10131 
10132  /**
10133  * \brief Check if the ast node is an instance of ast::ProcedureBlock
10134  * \return true as object is of type ast::ProcedureBlock
10135  */
10136  bool is_procedure_block() const noexcept override { return true; }
10137 
10138  /**
10139  * \brief Return a copy of the current node
10140  *
10141  * Recursively make a new copy/clone of the current node including
10142  * all members and return a pointer to the node. This is used for
10143  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
10144  * ast.
10145  *
10146  * @return pointer to the clone/copy of the current node
10147  */
10148  ProcedureBlock *clone() const override { return new ProcedureBlock(*this); }
10149 
10150  /// \name Getters
10151  /// \{
10152 
10153  /**
10154  * \brief Return type (ast::AstNodeType) of ast node
10155  *
10156  * Every node in the ast has a type defined in ast::AstNodeType and this
10157  * function is used to retrieve the same.
10158  *
10159  * \return ast node type i.e. ast::AstNodeType::PROCEDURE_BLOCK
10160  *
10161  * \sa Ast::get_node_type_name
10162  */
10163  AstNodeType get_node_type() const noexcept override {
10165  }
10166 
10167  /**
10168  * \brief Return type (ast::AstNodeType) of ast node as std::string
10169  *
10170  * Every node in the ast has a type defined in ast::AstNodeType.
10171  * This type name can be returned as a std::string for printing
10172  * node to text/json form.
10173  *
10174  * \return name of the node type as a string i.e. "ProcedureBlock"
10175  *
10176  * \sa Ast::get_node_name
10177  */
10178  std::string get_node_type_name() const noexcept override {
10179  return "ProcedureBlock";
10180  }
10181 
10182  /**
10183  * \brief Return NMODL statement of ast node as std::string
10184  *
10185  * Every node is related to a special statement in the NMODL. This
10186  * statement can be returned as a std::string for printing to
10187  * text/json form.
10188  *
10189  * \return name of the statement as a string i.e. "PROCEDURE "
10190  *
10191  * \sa Ast::get_nmodl_name
10192  */
10193  std::string get_nmodl_name() const noexcept override { return "PROCEDURE "; }
10194 
10195  /**
10196  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10197  */
10198  std::shared_ptr<Ast> get_shared_ptr() override {
10199  return std::static_pointer_cast<ProcedureBlock>(shared_from_this());
10200  }
10201 
10202  /**
10203  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10204  */
10205  std::shared_ptr<const Ast> get_shared_ptr() const override {
10206  return std::static_pointer_cast<const ProcedureBlock>(shared_from_this());
10207  }
10208 
10209  /**
10210  * \brief Return associated token for the current ast node
10211  *
10212  * Not all ast nodes have token information. For example,
10213  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
10214  * solution of ODEs. In this case, we return nullptr to store in the
10215  * nmodl::symtab::SymbolTable.
10216  *
10217  * \return pointer to token if exist otherwise nullptr
10218  */
10219  const ModToken *get_token() const noexcept override { return token.get(); }
10220 
10221  /**
10222  * \brief Return associated symbol table for the current ast node
10223  *
10224  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
10225  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
10226  * and it can be accessed using this method.
10227  *
10228  * \return pointer to the symbol table
10229  *
10230  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
10231  */
10232  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
10233 
10234  /**
10235  * \brief Return name of the node
10236  *
10237  * Some ast nodes have a member marked designated as node name. For example,
10238  * in case of this ast::Name has name designated as a
10239  * node name.
10240  *
10241  * @return name of the node as std::string
10242  *
10243  * \sa Ast::get_node_type_name
10244  */
10245  std::string get_node_name() const override;
10246 
10247  /**
10248  * \brief Getter for member variable \ref ProcedureBlock.name
10249  */
10250  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
10251 
10252  /**
10253  * \brief Getter for member variable \ref ProcedureBlock.parameters
10254  */
10255  const ArgumentVector &get_parameters() const noexcept override {
10256  return parameters;
10257  }
10258 
10259  /**
10260  * \brief Getter for member variable \ref ProcedureBlock.unit
10261  */
10262  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
10263 
10264  /**
10265  * \brief Getter for member variable \ref ProcedureBlock.statement_block
10266  */
10267  const std::shared_ptr<StatementBlock> &get_statement_block() const
10268  noexcept override {
10269  return statement_block;
10270  }
10271 
10272  /// \}
10273 
10274  /// \name Setters
10275  /// \{
10276 
10277  /**
10278  * \brief Set token for the current ast node
10279  */
10280  void set_token(const ModToken &tok) {
10281  token = std::make_shared<ModToken>(tok);
10282  }
10283 
10284  /**
10285  * \brief Set symbol table for the current ast node
10286  *
10287  * Top level, block scoped nodes store symbol table in the ast node.
10288  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
10289  * for every node in the ast.
10290  *
10291  * \sa nmodl::visitor::SymtabVisitor
10292  */
10293  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
10294  symtab = newsymtab;
10295  }
10296 
10297  /**
10298  * \brief Setter for member variable \ref ProcedureBlock.name (rvalue
10299  * reference)
10300  */
10301  void set_name(std::shared_ptr<Name> &&name);
10302 
10303  /**
10304  * \brief Setter for member variable \ref ProcedureBlock.name
10305  */
10306  void set_name(const std::shared_ptr<Name> &name);
10307 
10308  /**
10309  * \brief Setter for member variable \ref ProcedureBlock.parameters (rvalue
10310  * reference)
10311  */
10312  void set_parameters(ArgumentVector &&parameters);
10313 
10314  /**
10315  * \brief Setter for member variable \ref ProcedureBlock.parameters
10316  */
10317  void set_parameters(const ArgumentVector &parameters);
10318 
10319  /**
10320  * \brief Setter for member variable \ref ProcedureBlock.unit (rvalue
10321  * reference)
10322  */
10323  void set_unit(std::shared_ptr<Unit> &&unit);
10324 
10325  /**
10326  * \brief Setter for member variable \ref ProcedureBlock.unit
10327  */
10328  void set_unit(const std::shared_ptr<Unit> &unit);
10329 
10330  /**
10331  * \brief Setter for member variable \ref ProcedureBlock.statement_block
10332  * (rvalue reference)
10333  */
10334  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
10335 
10336  /**
10337  * \brief Setter for member variable \ref ProcedureBlock.statement_block
10338  */
10339  void
10340  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
10341 
10342  /// \}
10343 
10344  /// \name Visitor
10345  /// \{
10346 
10347  /**
10348  * \brief visit children i.e. member variables of current node using provided
10349  * visitor
10350  *
10351  * Different nodes in the AST have different members (i.e. children). This
10352  * method recursively visits children using provided visitor.
10353  *
10354  * \param v Concrete visitor that will be used to recursively visit children
10355  *
10356  * \sa Ast::visit_children for example.
10357  */
10358  void visit_children(visitor::Visitor &v) override;
10359 
10360  /**
10361  * \brief accept (or visit) the current AST node using provided visitor
10362  *
10363  * Instead of visiting children of AST node, like Ast::visit_children,
10364  * accept allows to visit the current node itself using provided concrete
10365  * visitor.
10366  *
10367  * \param v Concrete visitor that will be used to recursively visit node
10368  *
10369  * \sa Ast::accept for example.
10370  */
10371  void accept(visitor::Visitor &v) override;
10372 
10373  /// \}
10374 
10375 private:
10376  /**
10377  * \brief Set this object as parent for all the children
10378  *
10379  * This should be called in every object (with children) constructor
10380  * to set parents. Since it is called only in the constructors it
10381  * should not be virtual to avoid ambiguities (issue #295).
10382  */
10383  void set_parent_in_children();
10384 };
10385 
10386 /** @} */ // end of ast_class
10387 
10388 } // namespace ast
10389 } // namespace nmodl
10390 #endif // !NMODL_AST_PROCEDURE_BLOCK_HPP
10391 #ifndef NMODL_AST_NET_RECEIVE_BLOCK_HPP
10392 #define NMODL_AST_NET_RECEIVE_BLOCK_HPP
10393 
10394 namespace nmodl {
10395 namespace ast {
10396 
10397 /**
10398  * @addtogroup ast_class
10399  * @ingroup ast
10400  * @{
10401  */
10402 
10403 /**
10404  * \brief TODO
10405  *
10406  *
10407  */
10408 class NetReceiveBlock : public Block {
10409 private:
10410  /// Parameters to the net receive block
10412  /// Block with statements vector
10413  std::shared_ptr<StatementBlock> statement_block;
10414  /// token with location information
10415  std::shared_ptr<ModToken> token;
10416  /// symbol table for a block
10417  symtab::SymbolTable *symtab = nullptr;
10418 
10419 public:
10420  /// \name Ctor & dtor
10421  /// \{
10422 
10423  explicit NetReceiveBlock(ArgumentVector parameters,
10424  StatementBlock *statement_block);
10425  explicit NetReceiveBlock(
10426  const ArgumentVector &parameters,
10427  const std::shared_ptr<StatementBlock> &statement_block);
10428  NetReceiveBlock(const NetReceiveBlock &obj);
10429 
10430  virtual ~NetReceiveBlock() = default;
10431 
10432  /// \}
10433 
10434  /**
10435  * \brief Check if the ast node is an instance of ast::NetReceiveBlock
10436  * \return true as object is of type ast::NetReceiveBlock
10437  */
10438  bool is_net_receive_block() const noexcept override { return true; }
10439 
10440  /**
10441  * \brief Return a copy of the current node
10442  *
10443  * Recursively make a new copy/clone of the current node including
10444  * all members and return a pointer to the node. This is used for
10445  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
10446  * ast.
10447  *
10448  * @return pointer to the clone/copy of the current node
10449  */
10450  NetReceiveBlock *clone() const override { return new NetReceiveBlock(*this); }
10451 
10452  /// \name Getters
10453  /// \{
10454 
10455  /**
10456  * \brief Return type (ast::AstNodeType) of ast node
10457  *
10458  * Every node in the ast has a type defined in ast::AstNodeType and this
10459  * function is used to retrieve the same.
10460  *
10461  * \return ast node type i.e. ast::AstNodeType::NET_RECEIVE_BLOCK
10462  *
10463  * \sa Ast::get_node_type_name
10464  */
10465  AstNodeType get_node_type() const noexcept override {
10467  }
10468 
10469  /**
10470  * \brief Return type (ast::AstNodeType) of ast node as std::string
10471  *
10472  * Every node in the ast has a type defined in ast::AstNodeType.
10473  * This type name can be returned as a std::string for printing
10474  * node to text/json form.
10475  *
10476  * \return name of the node type as a string i.e. "NetReceiveBlock"
10477  *
10478  * \sa Ast::get_node_name
10479  */
10480  std::string get_node_type_name() const noexcept override {
10481  return "NetReceiveBlock";
10482  }
10483 
10484  /**
10485  * \brief Return NMODL statement of ast node as std::string
10486  *
10487  * Every node is related to a special statement in the NMODL. This
10488  * statement can be returned as a std::string for printing to
10489  * text/json form.
10490  *
10491  * \return name of the statement as a string i.e. "NET_RECEIVE "
10492  *
10493  * \sa Ast::get_nmodl_name
10494  */
10495  std::string get_nmodl_name() const noexcept override {
10496  return "NET_RECEIVE ";
10497  }
10498 
10499  /**
10500  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10501  */
10502  std::shared_ptr<Ast> get_shared_ptr() override {
10503  return std::static_pointer_cast<NetReceiveBlock>(shared_from_this());
10504  }
10505 
10506  /**
10507  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10508  */
10509  std::shared_ptr<const Ast> get_shared_ptr() const override {
10510  return std::static_pointer_cast<const NetReceiveBlock>(shared_from_this());
10511  }
10512 
10513  /**
10514  * \brief Return associated token for the current ast node
10515  *
10516  * Not all ast nodes have token information. For example,
10517  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
10518  * solution of ODEs. In this case, we return nullptr to store in the
10519  * nmodl::symtab::SymbolTable.
10520  *
10521  * \return pointer to token if exist otherwise nullptr
10522  */
10523  const ModToken *get_token() const noexcept override { return token.get(); }
10524 
10525  /**
10526  * \brief Return associated symbol table for the current ast node
10527  *
10528  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
10529  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
10530  * and it can be accessed using this method.
10531  *
10532  * \return pointer to the symbol table
10533  *
10534  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
10535  */
10536  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
10537 
10538  /**
10539  * \brief Getter for member variable \ref NetReceiveBlock.parameters
10540  */
10541  const ArgumentVector &get_parameters() const noexcept override {
10542  return parameters;
10543  }
10544 
10545  /**
10546  * \brief Getter for member variable \ref NetReceiveBlock.statement_block
10547  */
10548  const std::shared_ptr<StatementBlock> &get_statement_block() const
10549  noexcept override {
10550  return statement_block;
10551  }
10552 
10553  /// \}
10554 
10555  /// \name Setters
10556  /// \{
10557 
10558  /**
10559  * \brief Set token for the current ast node
10560  */
10561  void set_token(const ModToken &tok) {
10562  token = std::make_shared<ModToken>(tok);
10563  }
10564 
10565  /**
10566  * \brief Set symbol table for the current ast node
10567  *
10568  * Top level, block scoped nodes store symbol table in the ast node.
10569  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
10570  * for every node in the ast.
10571  *
10572  * \sa nmodl::visitor::SymtabVisitor
10573  */
10574  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
10575  symtab = newsymtab;
10576  }
10577 
10578  /**
10579  * \brief Setter for member variable \ref NetReceiveBlock.parameters (rvalue
10580  * reference)
10581  */
10582  void set_parameters(ArgumentVector &&parameters);
10583 
10584  /**
10585  * \brief Setter for member variable \ref NetReceiveBlock.parameters
10586  */
10587  void set_parameters(const ArgumentVector &parameters);
10588 
10589  /**
10590  * \brief Setter for member variable \ref NetReceiveBlock.statement_block
10591  * (rvalue reference)
10592  */
10593  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
10594 
10595  /**
10596  * \brief Setter for member variable \ref NetReceiveBlock.statement_block
10597  */
10598  void
10599  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
10600 
10601  /// \}
10602 
10603  /// \name Visitor
10604  /// \{
10605 
10606  /**
10607  * \brief visit children i.e. member variables of current node using provided
10608  * visitor
10609  *
10610  * Different nodes in the AST have different members (i.e. children). This
10611  * method recursively visits children using provided visitor.
10612  *
10613  * \param v Concrete visitor that will be used to recursively visit children
10614  *
10615  * \sa Ast::visit_children for example.
10616  */
10617  void visit_children(visitor::Visitor &v) override;
10618 
10619  /**
10620  * \brief accept (or visit) the current AST node using provided visitor
10621  *
10622  * Instead of visiting children of AST node, like Ast::visit_children,
10623  * accept allows to visit the current node itself using provided concrete
10624  * visitor.
10625  *
10626  * \param v Concrete visitor that will be used to recursively visit node
10627  *
10628  * \sa Ast::accept for example.
10629  */
10630  void accept(visitor::Visitor &v) override;
10631 
10632  /// \}
10633 
10634 private:
10635  /**
10636  * \brief Set this object as parent for all the children
10637  *
10638  * This should be called in every object (with children) constructor
10639  * to set parents. Since it is called only in the constructors it
10640  * should not be virtual to avoid ambiguities (issue #295).
10641  */
10642  void set_parent_in_children();
10643 };
10644 
10645 /** @} */ // end of ast_class
10646 
10647 } // namespace ast
10648 } // namespace nmodl
10649 #endif // !NMODL_AST_NET_RECEIVE_BLOCK_HPP
10650 #ifndef NMODL_AST_SOLVE_BLOCK_HPP
10651 #define NMODL_AST_SOLVE_BLOCK_HPP
10652 
10653 namespace nmodl {
10654 namespace ast {
10655 
10656 /**
10657  * @addtogroup ast_class
10658  * @ingroup ast
10659  * @{
10660  */
10661 
10662 /**
10663  * \brief TODO
10664  *
10665  *
10666  */
10667 class SolveBlock : public Block {
10668 private:
10669  /// Name of the block to solve
10670  std::shared_ptr<Name> block_name;
10671  /// Name of the integration method
10672  std::shared_ptr<Name> method;
10673  /// Name of the integration method
10674  std::shared_ptr<Name> steadystate;
10675  /// Block to be executed on error
10676  std::shared_ptr<StatementBlock> ifsolerr;
10677  /// token with location information
10678  std::shared_ptr<ModToken> token;
10679  /// symbol table for a block
10680  symtab::SymbolTable *symtab = nullptr;
10681 
10682 public:
10683  /// \name Ctor & dtor
10684  /// \{
10685 
10686  explicit SolveBlock(Name *block_name, Name *method, Name *steadystate,
10687  StatementBlock *ifsolerr);
10688  explicit SolveBlock(const std::shared_ptr<Name> &block_name,
10689  const std::shared_ptr<Name> &method,
10690  const std::shared_ptr<Name> &steadystate,
10691  const std::shared_ptr<StatementBlock> &ifsolerr);
10692  SolveBlock(const SolveBlock &obj);
10693 
10694  virtual ~SolveBlock() = default;
10695 
10696  /// \}
10697 
10698  /**
10699  * \brief Check if the ast node is an instance of ast::SolveBlock
10700  * \return true as object is of type ast::SolveBlock
10701  */
10702  bool is_solve_block() const noexcept override { return true; }
10703 
10704  /**
10705  * \brief Return a copy of the current node
10706  *
10707  * Recursively make a new copy/clone of the current node including
10708  * all members and return a pointer to the node. This is used for
10709  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
10710  * ast.
10711  *
10712  * @return pointer to the clone/copy of the current node
10713  */
10714  SolveBlock *clone() const override { return new SolveBlock(*this); }
10715 
10716  /// \name Getters
10717  /// \{
10718 
10719  /**
10720  * \brief Return type (ast::AstNodeType) of ast node
10721  *
10722  * Every node in the ast has a type defined in ast::AstNodeType and this
10723  * function is used to retrieve the same.
10724  *
10725  * \return ast node type i.e. ast::AstNodeType::SOLVE_BLOCK
10726  *
10727  * \sa Ast::get_node_type_name
10728  */
10729  AstNodeType get_node_type() const noexcept override {
10730  return AstNodeType::SOLVE_BLOCK;
10731  }
10732 
10733  /**
10734  * \brief Return type (ast::AstNodeType) of ast node as std::string
10735  *
10736  * Every node in the ast has a type defined in ast::AstNodeType.
10737  * This type name can be returned as a std::string for printing
10738  * node to text/json form.
10739  *
10740  * \return name of the node type as a string i.e. "SolveBlock"
10741  *
10742  * \sa Ast::get_node_name
10743  */
10744  std::string get_node_type_name() const noexcept override {
10745  return "SolveBlock";
10746  }
10747 
10748  /**
10749  * \brief Return NMODL statement of ast node as std::string
10750  *
10751  * Every node is related to a special statement in the NMODL. This
10752  * statement can be returned as a std::string for printing to
10753  * text/json form.
10754  *
10755  * \return name of the statement as a string i.e. "SOLVE"
10756  *
10757  * \sa Ast::get_nmodl_name
10758  */
10759  std::string get_nmodl_name() const noexcept override { return "SOLVE"; }
10760 
10761  /**
10762  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10763  */
10764  std::shared_ptr<Ast> get_shared_ptr() override {
10765  return std::static_pointer_cast<SolveBlock>(shared_from_this());
10766  }
10767 
10768  /**
10769  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10770  */
10771  std::shared_ptr<const Ast> get_shared_ptr() const override {
10772  return std::static_pointer_cast<const SolveBlock>(shared_from_this());
10773  }
10774 
10775  /**
10776  * \brief Return associated token for the current ast node
10777  *
10778  * Not all ast nodes have token information. For example,
10779  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
10780  * solution of ODEs. In this case, we return nullptr to store in the
10781  * nmodl::symtab::SymbolTable.
10782  *
10783  * \return pointer to token if exist otherwise nullptr
10784  */
10785  const ModToken *get_token() const noexcept override { return token.get(); }
10786 
10787  /**
10788  * \brief Return associated symbol table for the current ast node
10789  *
10790  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
10791  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
10792  * and it can be accessed using this method.
10793  *
10794  * \return pointer to the symbol table
10795  *
10796  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
10797  */
10798  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
10799 
10800  /**
10801  * \brief Getter for member variable \ref SolveBlock.block_name
10802  */
10803  const std::shared_ptr<Name> &get_block_name() const noexcept {
10804  return block_name;
10805  }
10806 
10807  /**
10808  * \brief Getter for member variable \ref SolveBlock.method
10809  */
10810  const std::shared_ptr<Name> &get_method() const noexcept { return method; }
10811 
10812  /**
10813  * \brief Getter for member variable \ref SolveBlock.steadystate
10814  */
10815  const std::shared_ptr<Name> &get_steadystate() const noexcept {
10816  return steadystate;
10817  }
10818 
10819  /**
10820  * \brief Getter for member variable \ref SolveBlock.ifsolerr
10821  */
10822  const std::shared_ptr<StatementBlock> &get_ifsolerr() const noexcept {
10823  return ifsolerr;
10824  }
10825 
10826  /// \}
10827 
10828  /// \name Setters
10829  /// \{
10830 
10831  /**
10832  * \brief Set token for the current ast node
10833  */
10834  void set_token(const ModToken &tok) {
10835  token = std::make_shared<ModToken>(tok);
10836  }
10837 
10838  /**
10839  * \brief Set symbol table for the current ast node
10840  *
10841  * Top level, block scoped nodes store symbol table in the ast node.
10842  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
10843  * for every node in the ast.
10844  *
10845  * \sa nmodl::visitor::SymtabVisitor
10846  */
10847  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
10848  symtab = newsymtab;
10849  }
10850 
10851  /**
10852  * \brief Setter for member variable \ref SolveBlock.block_name (rvalue
10853  * reference)
10854  */
10855  void set_block_name(std::shared_ptr<Name> &&block_name);
10856 
10857  /**
10858  * \brief Setter for member variable \ref SolveBlock.block_name
10859  */
10860  void set_block_name(const std::shared_ptr<Name> &block_name);
10861 
10862  /**
10863  * \brief Setter for member variable \ref SolveBlock.method (rvalue reference)
10864  */
10865  void set_method(std::shared_ptr<Name> &&method);
10866 
10867  /**
10868  * \brief Setter for member variable \ref SolveBlock.method
10869  */
10870  void set_method(const std::shared_ptr<Name> &method);
10871 
10872  /**
10873  * \brief Setter for member variable \ref SolveBlock.steadystate (rvalue
10874  * reference)
10875  */
10876  void set_steadystate(std::shared_ptr<Name> &&steadystate);
10877 
10878  /**
10879  * \brief Setter for member variable \ref SolveBlock.steadystate
10880  */
10881  void set_steadystate(const std::shared_ptr<Name> &steadystate);
10882 
10883  /**
10884  * \brief Setter for member variable \ref SolveBlock.ifsolerr (rvalue
10885  * reference)
10886  */
10887  void set_ifsolerr(std::shared_ptr<StatementBlock> &&ifsolerr);
10888 
10889  /**
10890  * \brief Setter for member variable \ref SolveBlock.ifsolerr
10891  */
10892  void set_ifsolerr(const std::shared_ptr<StatementBlock> &ifsolerr);
10893 
10894  /// \}
10895 
10896  /// \name Visitor
10897  /// \{
10898 
10899  /**
10900  * \brief visit children i.e. member variables of current node using provided
10901  * visitor
10902  *
10903  * Different nodes in the AST have different members (i.e. children). This
10904  * method recursively visits children using provided visitor.
10905  *
10906  * \param v Concrete visitor that will be used to recursively visit children
10907  *
10908  * \sa Ast::visit_children for example.
10909  */
10910  void visit_children(visitor::Visitor &v) override;
10911 
10912  /**
10913  * \brief accept (or visit) the current AST node using provided visitor
10914  *
10915  * Instead of visiting children of AST node, like Ast::visit_children,
10916  * accept allows to visit the current node itself using provided concrete
10917  * visitor.
10918  *
10919  * \param v Concrete visitor that will be used to recursively visit node
10920  *
10921  * \sa Ast::accept for example.
10922  */
10923  void accept(visitor::Visitor &v) override;
10924 
10925  /// \}
10926 
10927 private:
10928  /**
10929  * \brief Set this object as parent for all the children
10930  *
10931  * This should be called in every object (with children) constructor
10932  * to set parents. Since it is called only in the constructors it
10933  * should not be virtual to avoid ambiguities (issue #295).
10934  */
10935  void set_parent_in_children();
10936 };
10937 
10938 /** @} */ // end of ast_class
10939 
10940 } // namespace ast
10941 } // namespace nmodl
10942 #endif // !NMODL_AST_SOLVE_BLOCK_HPP
10943 #ifndef NMODL_AST_BREAKPOINT_BLOCK_HPP
10944 #define NMODL_AST_BREAKPOINT_BLOCK_HPP
10945 
10946 namespace nmodl {
10947 namespace ast {
10948 
10949 /**
10950  * @addtogroup ast_class
10951  * @ingroup ast
10952  * @{
10953  */
10954 
10955 /**
10956  * \brief Represents a `BREAKPOINT` block in NMODL
10957  *
10958  * The `BREAKPOINT` block is used to update current and conductance.
10959  * at each time step. Here is an example of `BEFORE` :
10960  *
10961  * \code{.mod}
10962  * BREAKPOINT {
10963  * SOLVE states METHOD cnexp
10964  * gna = gnabar*m*m*m*h
10965  * ina = gna*(v - ena)
10966  * gk = gkbar*n*n*n*n
10967  * ik = gk*(v - ek)
10968  * il = gl*(v - el)
10969  * }
10970  * \endcode
10971  *
10972  * \sa ast::DerivativeBlock ast::InitialBlock
10973  *
10974  */
10975 class BreakpointBlock : public Block {
10976 private:
10977  /// Block with statements vector
10978  std::shared_ptr<StatementBlock> statement_block;
10979  /// token with location information
10980  std::shared_ptr<ModToken> token;
10981  /// symbol table for a block
10982  symtab::SymbolTable *symtab = nullptr;
10983 
10984 public:
10985  /// \name Ctor & dtor
10986  /// \{
10987 
10988  explicit BreakpointBlock(StatementBlock *statement_block);
10989  explicit BreakpointBlock(
10990  const std::shared_ptr<StatementBlock> &statement_block);
10991  BreakpointBlock(const BreakpointBlock &obj);
10992 
10993  virtual ~BreakpointBlock() = default;
10994 
10995  /// \}
10996 
10997  /**
10998  * \brief Check if the ast node is an instance of ast::BreakpointBlock
10999  * \return true as object is of type ast::BreakpointBlock
11000  */
11001  bool is_breakpoint_block() const noexcept override { return true; }
11002 
11003  /**
11004  * \brief Return a copy of the current node
11005  *
11006  * Recursively make a new copy/clone of the current node including
11007  * all members and return a pointer to the node. This is used for
11008  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11009  * ast.
11010  *
11011  * @return pointer to the clone/copy of the current node
11012  */
11013  BreakpointBlock *clone() const override { return new BreakpointBlock(*this); }
11014 
11015  /// \name Getters
11016  /// \{
11017 
11018  /**
11019  * \brief Return type (ast::AstNodeType) of ast node
11020  *
11021  * Every node in the ast has a type defined in ast::AstNodeType and this
11022  * function is used to retrieve the same.
11023  *
11024  * \return ast node type i.e. ast::AstNodeType::BREAKPOINT_BLOCK
11025  *
11026  * \sa Ast::get_node_type_name
11027  */
11028  AstNodeType get_node_type() const noexcept override {
11030  }
11031 
11032  /**
11033  * \brief Return type (ast::AstNodeType) of ast node as std::string
11034  *
11035  * Every node in the ast has a type defined in ast::AstNodeType.
11036  * This type name can be returned as a std::string for printing
11037  * node to text/json form.
11038  *
11039  * \return name of the node type as a string i.e. "BreakpointBlock"
11040  *
11041  * \sa Ast::get_node_name
11042  */
11043  std::string get_node_type_name() const noexcept override {
11044  return "BreakpointBlock";
11045  }
11046 
11047  /**
11048  * \brief Return NMODL statement of ast node as std::string
11049  *
11050  * Every node is related to a special statement in the NMODL. This
11051  * statement can be returned as a std::string for printing to
11052  * text/json form.
11053  *
11054  * \return name of the statement as a string i.e. "BREAKPOINT "
11055  *
11056  * \sa Ast::get_nmodl_name
11057  */
11058  std::string get_nmodl_name() const noexcept override { return "BREAKPOINT "; }
11059 
11060  /**
11061  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11062  */
11063  std::shared_ptr<Ast> get_shared_ptr() override {
11064  return std::static_pointer_cast<BreakpointBlock>(shared_from_this());
11065  }
11066 
11067  /**
11068  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11069  */
11070  std::shared_ptr<const Ast> get_shared_ptr() const override {
11071  return std::static_pointer_cast<const BreakpointBlock>(shared_from_this());
11072  }
11073 
11074  /**
11075  * \brief Return associated token for the current ast node
11076  *
11077  * Not all ast nodes have token information. For example,
11078  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
11079  * solution of ODEs. In this case, we return nullptr to store in the
11080  * nmodl::symtab::SymbolTable.
11081  *
11082  * \return pointer to token if exist otherwise nullptr
11083  */
11084  const ModToken *get_token() const noexcept override { return token.get(); }
11085 
11086  /**
11087  * \brief Return associated symbol table for the current ast node
11088  *
11089  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11090  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11091  * and it can be accessed using this method.
11092  *
11093  * \return pointer to the symbol table
11094  *
11095  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11096  */
11097  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
11098 
11099  /**
11100  * \brief Getter for member variable \ref BreakpointBlock.statement_block
11101  */
11102  const std::shared_ptr<StatementBlock> &get_statement_block() const
11103  noexcept override {
11104  return statement_block;
11105  }
11106 
11107  /// \}
11108 
11109  /// \name Setters
11110  /// \{
11111 
11112  /**
11113  * \brief Set token for the current ast node
11114  */
11115  void set_token(const ModToken &tok) {
11116  token = std::make_shared<ModToken>(tok);
11117  }
11118 
11119  /**
11120  * \brief Set symbol table for the current ast node
11121  *
11122  * Top level, block scoped nodes store symbol table in the ast node.
11123  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11124  * for every node in the ast.
11125  *
11126  * \sa nmodl::visitor::SymtabVisitor
11127  */
11128  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
11129  symtab = newsymtab;
11130  }
11131 
11132  /**
11133  * \brief Setter for member variable \ref BreakpointBlock.statement_block
11134  * (rvalue reference)
11135  */
11136  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
11137 
11138  /**
11139  * \brief Setter for member variable \ref BreakpointBlock.statement_block
11140  */
11141  void
11142  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
11143 
11144  /// \}
11145 
11146  /// \name Visitor
11147  /// \{
11148 
11149  /**
11150  * \brief visit children i.e. member variables of current node using provided
11151  * visitor
11152  *
11153  * Different nodes in the AST have different members (i.e. children). This
11154  * method recursively visits children using provided visitor.
11155  *
11156  * \param v Concrete visitor that will be used to recursively visit children
11157  *
11158  * \sa Ast::visit_children for example.
11159  */
11160  void visit_children(visitor::Visitor &v) override;
11161 
11162  /**
11163  * \brief accept (or visit) the current AST node using provided visitor
11164  *
11165  * Instead of visiting children of AST node, like Ast::visit_children,
11166  * accept allows to visit the current node itself using provided concrete
11167  * visitor.
11168  *
11169  * \param v Concrete visitor that will be used to recursively visit node
11170  *
11171  * \sa Ast::accept for example.
11172  */
11173  void accept(visitor::Visitor &v) override;
11174 
11175  /// \}
11176 
11177 private:
11178  /**
11179  * \brief Set this object as parent for all the children
11180  *
11181  * This should be called in every object (with children) constructor
11182  * to set parents. Since it is called only in the constructors it
11183  * should not be virtual to avoid ambiguities (issue #295).
11184  */
11185  void set_parent_in_children();
11186 };
11187 
11188 /** @} */ // end of ast_class
11189 
11190 } // namespace ast
11191 } // namespace nmodl
11192 #endif // !NMODL_AST_BREAKPOINT_BLOCK_HPP
11193 #ifndef NMODL_AST_TERMINAL_BLOCK_HPP
11194 #define NMODL_AST_TERMINAL_BLOCK_HPP
11195 
11196 namespace nmodl {
11197 namespace ast {
11198 
11199 /**
11200  * @addtogroup ast_class
11201  * @ingroup ast
11202  * @{
11203  */
11204 
11205 /**
11206  * \brief TODO
11207  *
11208  *
11209  */
11210 class TerminalBlock : public Block {
11211 private:
11212  /// Block with statements vector
11213  std::shared_ptr<StatementBlock> statement_block;
11214  /// token with location information
11215  std::shared_ptr<ModToken> token;
11216  /// symbol table for a block
11217  symtab::SymbolTable *symtab = nullptr;
11218 
11219 public:
11220  /// \name Ctor & dtor
11221  /// \{
11222 
11223  explicit TerminalBlock(StatementBlock *statement_block);
11224  explicit TerminalBlock(
11225  const std::shared_ptr<StatementBlock> &statement_block);
11226  TerminalBlock(const TerminalBlock &obj);
11227 
11228  virtual ~TerminalBlock() = default;
11229 
11230  /// \}
11231 
11232  /**
11233  * \brief Check if the ast node is an instance of ast::TerminalBlock
11234  * \return true as object is of type ast::TerminalBlock
11235  */
11236  bool is_terminal_block() const noexcept override { return true; }
11237 
11238  /**
11239  * \brief Return a copy of the current node
11240  *
11241  * Recursively make a new copy/clone of the current node including
11242  * all members and return a pointer to the node. This is used for
11243  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11244  * ast.
11245  *
11246  * @return pointer to the clone/copy of the current node
11247  */
11248  TerminalBlock *clone() const override { return new TerminalBlock(*this); }
11249 
11250  /// \name Getters
11251  /// \{
11252 
11253  /**
11254  * \brief Return type (ast::AstNodeType) of ast node
11255  *
11256  * Every node in the ast has a type defined in ast::AstNodeType and this
11257  * function is used to retrieve the same.
11258  *
11259  * \return ast node type i.e. ast::AstNodeType::TERMINAL_BLOCK
11260  *
11261  * \sa Ast::get_node_type_name
11262  */
11263  AstNodeType get_node_type() const noexcept override {
11265  }
11266 
11267  /**
11268  * \brief Return type (ast::AstNodeType) of ast node as std::string
11269  *
11270  * Every node in the ast has a type defined in ast::AstNodeType.
11271  * This type name can be returned as a std::string for printing
11272  * node to text/json form.
11273  *
11274  * \return name of the node type as a string i.e. "TerminalBlock"
11275  *
11276  * \sa Ast::get_node_name
11277  */
11278  std::string get_node_type_name() const noexcept override {
11279  return "TerminalBlock";
11280  }
11281 
11282  /**
11283  * \brief Return NMODL statement of ast node as std::string
11284  *
11285  * Every node is related to a special statement in the NMODL. This
11286  * statement can be returned as a std::string for printing to
11287  * text/json form.
11288  *
11289  * \return name of the statement as a string i.e. "TERMINAL "
11290  *
11291  * \sa Ast::get_nmodl_name
11292  */
11293  std::string get_nmodl_name() const noexcept override { return "TERMINAL "; }
11294 
11295  /**
11296  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11297  */
11298  std::shared_ptr<Ast> get_shared_ptr() override {
11299  return std::static_pointer_cast<TerminalBlock>(shared_from_this());
11300  }
11301 
11302  /**
11303  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11304  */
11305  std::shared_ptr<const Ast> get_shared_ptr() const override {
11306  return std::static_pointer_cast<const TerminalBlock>(shared_from_this());
11307  }
11308 
11309  /**
11310  * \brief Return associated token for the current ast node
11311  *
11312  * Not all ast nodes have token information. For example,
11313  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
11314  * solution of ODEs. In this case, we return nullptr to store in the
11315  * nmodl::symtab::SymbolTable.
11316  *
11317  * \return pointer to token if exist otherwise nullptr
11318  */
11319  const ModToken *get_token() const noexcept override { return token.get(); }
11320 
11321  /**
11322  * \brief Return associated symbol table for the current ast node
11323  *
11324  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11325  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11326  * and it can be accessed using this method.
11327  *
11328  * \return pointer to the symbol table
11329  *
11330  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11331  */
11332  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
11333 
11334  /**
11335  * \brief Getter for member variable \ref TerminalBlock.statement_block
11336  */
11337  const std::shared_ptr<StatementBlock> &get_statement_block() const
11338  noexcept override {
11339  return statement_block;
11340  }
11341 
11342  /// \}
11343 
11344  /// \name Setters
11345  /// \{
11346 
11347  /**
11348  * \brief Set token for the current ast node
11349  */
11350  void set_token(const ModToken &tok) {
11351  token = std::make_shared<ModToken>(tok);
11352  }
11353 
11354  /**
11355  * \brief Set symbol table for the current ast node
11356  *
11357  * Top level, block scoped nodes store symbol table in the ast node.
11358  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11359  * for every node in the ast.
11360  *
11361  * \sa nmodl::visitor::SymtabVisitor
11362  */
11363  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
11364  symtab = newsymtab;
11365  }
11366 
11367  /**
11368  * \brief Setter for member variable \ref TerminalBlock.statement_block
11369  * (rvalue reference)
11370  */
11371  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
11372 
11373  /**
11374  * \brief Setter for member variable \ref TerminalBlock.statement_block
11375  */
11376  void
11377  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
11378 
11379  /// \}
11380 
11381  /// \name Visitor
11382  /// \{
11383 
11384  /**
11385  * \brief visit children i.e. member variables of current node using provided
11386  * visitor
11387  *
11388  * Different nodes in the AST have different members (i.e. children). This
11389  * method recursively visits children using provided visitor.
11390  *
11391  * \param v Concrete visitor that will be used to recursively visit children
11392  *
11393  * \sa Ast::visit_children for example.
11394  */
11395  void visit_children(visitor::Visitor &v) override;
11396 
11397  /**
11398  * \brief accept (or visit) the current AST node using provided visitor
11399  *
11400  * Instead of visiting children of AST node, like Ast::visit_children,
11401  * accept allows to visit the current node itself using provided concrete
11402  * visitor.
11403  *
11404  * \param v Concrete visitor that will be used to recursively visit node
11405  *
11406  * \sa Ast::accept for example.
11407  */
11408  void accept(visitor::Visitor &v) override;
11409 
11410  /// \}
11411 
11412 private:
11413  /**
11414  * \brief Set this object as parent for all the children
11415  *
11416  * This should be called in every object (with children) constructor
11417  * to set parents. Since it is called only in the constructors it
11418  * should not be virtual to avoid ambiguities (issue #295).
11419  */
11420  void set_parent_in_children();
11421 };
11422 
11423 /** @} */ // end of ast_class
11424 
11425 } // namespace ast
11426 } // namespace nmodl
11427 #endif // !NMODL_AST_TERMINAL_BLOCK_HPP
11428 #ifndef NMODL_AST_BEFORE_BLOCK_HPP
11429 #define NMODL_AST_BEFORE_BLOCK_HPP
11430 
11431 namespace nmodl {
11432 namespace ast {
11433 
11434 /**
11435  * @addtogroup ast_class
11436  * @ingroup ast
11437  * @{
11438  */
11439 
11440 /**
11441  * \brief Represents a `BEFORE` block in NMODL
11442  *
11443  *
11444  */
11445 class BeforeBlock : public Block {
11446 private:
11447  /// Block to be called before
11448  std::shared_ptr<BABlock> bablock;
11449  /// token with location information
11450  std::shared_ptr<ModToken> token;
11451  /// symbol table for a block
11452  symtab::SymbolTable *symtab = nullptr;
11453 
11454 public:
11455  /// \name Ctor & dtor
11456  /// \{
11457 
11458  explicit BeforeBlock(BABlock *bablock);
11459  explicit BeforeBlock(const std::shared_ptr<BABlock> &bablock);
11460  BeforeBlock(const BeforeBlock &obj);
11461 
11462  virtual ~BeforeBlock() = default;
11463 
11464  /// \}
11465 
11466  /**
11467  * \brief Check if the ast node is an instance of ast::BeforeBlock
11468  * \return true as object is of type ast::BeforeBlock
11469  */
11470  bool is_before_block() const noexcept override { return true; }
11471 
11472  /**
11473  * \brief Return a copy of the current node
11474  *
11475  * Recursively make a new copy/clone of the current node including
11476  * all members and return a pointer to the node. This is used for
11477  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11478  * ast.
11479  *
11480  * @return pointer to the clone/copy of the current node
11481  */
11482  BeforeBlock *clone() const override { return new BeforeBlock(*this); }
11483 
11484  /// \name Getters
11485  /// \{
11486 
11487  /**
11488  * \brief Return type (ast::AstNodeType) of ast node
11489  *
11490  * Every node in the ast has a type defined in ast::AstNodeType and this
11491  * function is used to retrieve the same.
11492  *
11493  * \return ast node type i.e. ast::AstNodeType::BEFORE_BLOCK
11494  *
11495  * \sa Ast::get_node_type_name
11496  */
11497  AstNodeType get_node_type() const noexcept override {
11499  }
11500 
11501  /**
11502  * \brief Return type (ast::AstNodeType) of ast node as std::string
11503  *
11504  * Every node in the ast has a type defined in ast::AstNodeType.
11505  * This type name can be returned as a std::string for printing
11506  * node to text/json form.
11507  *
11508  * \return name of the node type as a string i.e. "BeforeBlock"
11509  *
11510  * \sa Ast::get_node_name
11511  */
11512  std::string get_node_type_name() const noexcept override {
11513  return "BeforeBlock";
11514  }
11515 
11516  /**
11517  * \brief Return NMODL statement of ast node as std::string
11518  *
11519  * Every node is related to a special statement in the NMODL. This
11520  * statement can be returned as a std::string for printing to
11521  * text/json form.
11522  *
11523  * \return name of the statement as a string i.e. "BEFORE "
11524  *
11525  * \sa Ast::get_nmodl_name
11526  */
11527  std::string get_nmodl_name() const noexcept override { return "BEFORE "; }
11528 
11529  /**
11530  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11531  */
11532  std::shared_ptr<Ast> get_shared_ptr() override {
11533  return std::static_pointer_cast<BeforeBlock>(shared_from_this());
11534  }
11535 
11536  /**
11537  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11538  */
11539  std::shared_ptr<const Ast> get_shared_ptr() const override {
11540  return std::static_pointer_cast<const BeforeBlock>(shared_from_this());
11541  }
11542 
11543  /**
11544  * \brief Return associated token for the current ast node
11545  *
11546  * Not all ast nodes have token information. For example,
11547  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
11548  * solution of ODEs. In this case, we return nullptr to store in the
11549  * nmodl::symtab::SymbolTable.
11550  *
11551  * \return pointer to token if exist otherwise nullptr
11552  */
11553  const ModToken *get_token() const noexcept override { return token.get(); }
11554 
11555  /**
11556  * \brief Return associated symbol table for the current ast node
11557  *
11558  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11559  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11560  * and it can be accessed using this method.
11561  *
11562  * \return pointer to the symbol table
11563  *
11564  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11565  */
11566  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
11567 
11568  /**
11569  * \brief Getter for member variable \ref BeforeBlock.bablock
11570  */
11571  const std::shared_ptr<BABlock> &get_bablock() const noexcept {
11572  return bablock;
11573  }
11574 
11575  /// \}
11576 
11577  /// \name Setters
11578  /// \{
11579 
11580  /**
11581  * \brief Set token for the current ast node
11582  */
11583  void set_token(const ModToken &tok) {
11584  token = std::make_shared<ModToken>(tok);
11585  }
11586 
11587  /**
11588  * \brief Set symbol table for the current ast node
11589  *
11590  * Top level, block scoped nodes store symbol table in the ast node.
11591  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11592  * for every node in the ast.
11593  *
11594  * \sa nmodl::visitor::SymtabVisitor
11595  */
11596  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
11597  symtab = newsymtab;
11598  }
11599 
11600  /**
11601  * \brief Setter for member variable \ref BeforeBlock.bablock (rvalue
11602  * reference)
11603  */
11604  void set_bablock(std::shared_ptr<BABlock> &&bablock);
11605 
11606  /**
11607  * \brief Setter for member variable \ref BeforeBlock.bablock
11608  */
11609  void set_bablock(const std::shared_ptr<BABlock> &bablock);
11610 
11611  /// \}
11612 
11613  /// \name Visitor
11614  /// \{
11615 
11616  /**
11617  * \brief visit children i.e. member variables of current node using provided
11618  * visitor
11619  *
11620  * Different nodes in the AST have different members (i.e. children). This
11621  * method recursively visits children using provided visitor.
11622  *
11623  * \param v Concrete visitor that will be used to recursively visit children
11624  *
11625  * \sa Ast::visit_children for example.
11626  */
11627  void visit_children(visitor::Visitor &v) override;
11628 
11629  /**
11630  * \brief accept (or visit) the current AST node using provided visitor
11631  *
11632  * Instead of visiting children of AST node, like Ast::visit_children,
11633  * accept allows to visit the current node itself using provided concrete
11634  * visitor.
11635  *
11636  * \param v Concrete visitor that will be used to recursively visit node
11637  *
11638  * \sa Ast::accept for example.
11639  */
11640  void accept(visitor::Visitor &v) override;
11641 
11642  /// \}
11643 
11644 private:
11645  /**
11646  * \brief Set this object as parent for all the children
11647  *
11648  * This should be called in every object (with children) constructor
11649  * to set parents. Since it is called only in the constructors it
11650  * should not be virtual to avoid ambiguities (issue #295).
11651  */
11652  void set_parent_in_children();
11653 };
11654 
11655 /** @} */ // end of ast_class
11656 
11657 } // namespace ast
11658 } // namespace nmodl
11659 #endif // !NMODL_AST_BEFORE_BLOCK_HPP
11660 #ifndef NMODL_AST_AFTER_BLOCK_HPP
11661 #define NMODL_AST_AFTER_BLOCK_HPP
11662 
11663 namespace nmodl {
11664 namespace ast {
11665 
11666 /**
11667  * @addtogroup ast_class
11668  * @ingroup ast
11669  * @{
11670  */
11671 
11672 /**
11673  * \brief Represents a `AFTER` block in NMODL
11674  *
11675  * This represents a block to be executed before another block.
11676  * Here is an example of `BEFORE` :
11677  *
11678  * \code{.mod}
11679  * BEFORE STEP {
11680  * if (mode==1) {
11681  * if (ica<imax) {
11682  * imax = ica
11683  * timax = t
11684  * }
11685  * }
11686  * }
11687  * \endcode
11688  *
11689  */
11690 class AfterBlock : public Block {
11691 private:
11692  /// Block to be called after
11693  std::shared_ptr<BABlock> bablock;
11694  /// token with location information
11695  std::shared_ptr<ModToken> token;
11696  /// symbol table for a block
11697  symtab::SymbolTable *symtab = nullptr;
11698 
11699 public:
11700  /// \name Ctor & dtor
11701  /// \{
11702 
11703  explicit AfterBlock(BABlock *bablock);
11704  explicit AfterBlock(const std::shared_ptr<BABlock> &bablock);
11705  AfterBlock(const AfterBlock &obj);
11706 
11707  virtual ~AfterBlock() = default;
11708 
11709  /// \}
11710 
11711  /**
11712  * \brief Check if the ast node is an instance of ast::AfterBlock
11713  * \return true as object is of type ast::AfterBlock
11714  */
11715  bool is_after_block() const noexcept override { return true; }
11716 
11717  /**
11718  * \brief Return a copy of the current node
11719  *
11720  * Recursively make a new copy/clone of the current node including
11721  * all members and return a pointer to the node. This is used for
11722  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11723  * ast.
11724  *
11725  * @return pointer to the clone/copy of the current node
11726  */
11727  AfterBlock *clone() const override { return new AfterBlock(*this); }
11728 
11729  /// \name Getters
11730  /// \{
11731 
11732  /**
11733  * \brief Return type (ast::AstNodeType) of ast node
11734  *
11735  * Every node in the ast has a type defined in ast::AstNodeType and this
11736  * function is used to retrieve the same.
11737  *
11738  * \return ast node type i.e. ast::AstNodeType::AFTER_BLOCK
11739  *
11740  * \sa Ast::get_node_type_name
11741  */
11742  AstNodeType get_node_type() const noexcept override {
11743  return AstNodeType::AFTER_BLOCK;
11744  }
11745 
11746  /**
11747  * \brief Return type (ast::AstNodeType) of ast node as std::string
11748  *
11749  * Every node in the ast has a type defined in ast::AstNodeType.
11750  * This type name can be returned as a std::string for printing
11751  * node to text/json form.
11752  *
11753  * \return name of the node type as a string i.e. "AfterBlock"
11754  *
11755  * \sa Ast::get_node_name
11756  */
11757  std::string get_node_type_name() const noexcept override {
11758  return "AfterBlock";
11759  }
11760 
11761  /**
11762  * \brief Return NMODL statement of ast node as std::string
11763  *
11764  * Every node is related to a special statement in the NMODL. This
11765  * statement can be returned as a std::string for printing to
11766  * text/json form.
11767  *
11768  * \return name of the statement as a string i.e. "AFTER "
11769  *
11770  * \sa Ast::get_nmodl_name
11771  */
11772  std::string get_nmodl_name() const noexcept override { return "AFTER "; }
11773 
11774  /**
11775  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11776  */
11777  std::shared_ptr<Ast> get_shared_ptr() override {
11778  return std::static_pointer_cast<AfterBlock>(shared_from_this());
11779  }
11780 
11781  /**
11782  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11783  */
11784  std::shared_ptr<const Ast> get_shared_ptr() const override {
11785  return std::static_pointer_cast<const AfterBlock>(shared_from_this());
11786  }
11787 
11788  /**
11789  * \brief Return associated token for the current ast node
11790  *
11791  * Not all ast nodes have token information. For example,
11792  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
11793  * solution of ODEs. In this case, we return nullptr to store in the
11794  * nmodl::symtab::SymbolTable.
11795  *
11796  * \return pointer to token if exist otherwise nullptr
11797  */
11798  const ModToken *get_token() const noexcept override { return token.get(); }
11799 
11800  /**
11801  * \brief Return associated symbol table for the current ast node
11802  *
11803  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11804  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11805  * and it can be accessed using this method.
11806  *
11807  * \return pointer to the symbol table
11808  *
11809  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11810  */
11811  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
11812 
11813  /**
11814  * \brief Getter for member variable \ref AfterBlock.bablock
11815  */
11816  const std::shared_ptr<BABlock> &get_bablock() const noexcept {
11817  return bablock;
11818  }
11819 
11820  /// \}
11821 
11822  /// \name Setters
11823  /// \{
11824 
11825  /**
11826  * \brief Set token for the current ast node
11827  */
11828  void set_token(const ModToken &tok) {
11829  token = std::make_shared<ModToken>(tok);
11830  }
11831 
11832  /**
11833  * \brief Set symbol table for the current ast node
11834  *
11835  * Top level, block scoped nodes store symbol table in the ast node.
11836  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11837  * for every node in the ast.
11838  *
11839  * \sa nmodl::visitor::SymtabVisitor
11840  */
11841  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
11842  symtab = newsymtab;
11843  }
11844 
11845  /**
11846  * \brief Setter for member variable \ref AfterBlock.bablock (rvalue
11847  * reference)
11848  */
11849  void set_bablock(std::shared_ptr<BABlock> &&bablock);
11850 
11851  /**
11852  * \brief Setter for member variable \ref AfterBlock.bablock
11853  */
11854  void set_bablock(const std::shared_ptr<BABlock> &bablock);
11855 
11856  /// \}
11857 
11858  /// \name Visitor
11859  /// \{
11860 
11861  /**
11862  * \brief visit children i.e. member variables of current node using provided
11863  * visitor
11864  *
11865  * Different nodes in the AST have different members (i.e. children). This
11866  * method recursively visits children using provided visitor.
11867  *
11868  * \param v Concrete visitor that will be used to recursively visit children
11869  *
11870  * \sa Ast::visit_children for example.
11871  */
11872  void visit_children(visitor::Visitor &v) override;
11873 
11874  /**
11875  * \brief accept (or visit) the current AST node using provided visitor
11876  *
11877  * Instead of visiting children of AST node, like Ast::visit_children,
11878  * accept allows to visit the current node itself using provided concrete
11879  * visitor.
11880  *
11881  * \param v Concrete visitor that will be used to recursively visit node
11882  *
11883  * \sa Ast::accept for example.
11884  */
11885  void accept(visitor::Visitor &v) override;
11886 
11887  /// \}
11888 
11889 private:
11890  /**
11891  * \brief Set this object as parent for all the children
11892  *
11893  * This should be called in every object (with children) constructor
11894  * to set parents. Since it is called only in the constructors it
11895  * should not be virtual to avoid ambiguities (issue #295).
11896  */
11897  void set_parent_in_children();
11898 };
11899 
11900 /** @} */ // end of ast_class
11901 
11902 } // namespace ast
11903 } // namespace nmodl
11904 #endif // !NMODL_AST_AFTER_BLOCK_HPP
11905 #ifndef NMODL_AST_BA_BLOCK_HPP
11906 #define NMODL_AST_BA_BLOCK_HPP
11907 
11908 namespace nmodl {
11909 namespace ast {
11910 
11911 /**
11912  * @addtogroup ast_class
11913  * @ingroup ast
11914  * @{
11915  */
11916 
11917 /**
11918  * \brief Represents a block to be executed before or after another block
11919  *
11920  * This represents a block to be executed before or after another
11921  * block in NMODL. See ast::BeforeBlock and ast::AfterBlock for usage.
11922  *
11923  */
11924 class BABlock : public Block {
11925 private:
11926  /// Type of NMODL block
11927  std::shared_ptr<BABlockType> type;
11928  /// Block with statements vector
11929  std::shared_ptr<StatementBlock> statement_block;
11930  /// token with location information
11931  std::shared_ptr<ModToken> token;
11932  /// symbol table for a block
11933  symtab::SymbolTable *symtab = nullptr;
11934 
11935 public:
11936  /// \name Ctor & dtor
11937  /// \{
11938 
11939  explicit BABlock(BABlockType *type, StatementBlock *statement_block);
11940  explicit BABlock(const std::shared_ptr<BABlockType> &type,
11941  const std::shared_ptr<StatementBlock> &statement_block);
11942  BABlock(const BABlock &obj);
11943 
11944  virtual ~BABlock() = default;
11945 
11946  /// \}
11947 
11948  /**
11949  * \brief Check if the ast node is an instance of ast::BABlock
11950  * \return true as object is of type ast::BABlock
11951  */
11952  bool is_ba_block() const noexcept override { return true; }
11953 
11954  /**
11955  * \brief Return a copy of the current node
11956  *
11957  * Recursively make a new copy/clone of the current node including
11958  * all members and return a pointer to the node. This is used for
11959  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11960  * ast.
11961  *
11962  * @return pointer to the clone/copy of the current node
11963  */
11964  BABlock *clone() const override { return new BABlock(*this); }
11965 
11966  /// \name Getters
11967  /// \{
11968 
11969  /**
11970  * \brief Return type (ast::AstNodeType) of ast node
11971  *
11972  * Every node in the ast has a type defined in ast::AstNodeType and this
11973  * function is used to retrieve the same.
11974  *
11975  * \return ast node type i.e. ast::AstNodeType::BA_BLOCK
11976  *
11977  * \sa Ast::get_node_type_name
11978  */
11979  AstNodeType get_node_type() const noexcept override {
11980  return AstNodeType::BA_BLOCK;
11981  }
11982 
11983  /**
11984  * \brief Return type (ast::AstNodeType) of ast node as std::string
11985  *
11986  * Every node in the ast has a type defined in ast::AstNodeType.
11987  * This type name can be returned as a std::string for printing
11988  * node to text/json form.
11989  *
11990  * \return name of the node type as a string i.e. "BABlock"
11991  *
11992  * \sa Ast::get_node_name
11993  */
11994  std::string get_node_type_name() const noexcept override { return "BABlock"; }
11995 
11996  /**
11997  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11998  */
11999  std::shared_ptr<Ast> get_shared_ptr() override {
12000  return std::static_pointer_cast<BABlock>(shared_from_this());
12001  }
12002 
12003  /**
12004  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12005  */
12006  std::shared_ptr<const Ast> get_shared_ptr() const override {
12007  return std::static_pointer_cast<const BABlock>(shared_from_this());
12008  }
12009 
12010  /**
12011  * \brief Return associated token for the current ast node
12012  *
12013  * Not all ast nodes have token information. For example,
12014  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
12015  * solution of ODEs. In this case, we return nullptr to store in the
12016  * nmodl::symtab::SymbolTable.
12017  *
12018  * \return pointer to token if exist otherwise nullptr
12019  */
12020  const ModToken *get_token() const noexcept override { return token.get(); }
12021 
12022  /**
12023  * \brief Return associated symbol table for the current ast node
12024  *
12025  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12026  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12027  * and it can be accessed using this method.
12028  *
12029  * \return pointer to the symbol table
12030  *
12031  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12032  */
12033  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
12034 
12035  /**
12036  * \brief Getter for member variable \ref BABlock.type
12037  */
12038  const std::shared_ptr<BABlockType> &get_type() const noexcept { return type; }
12039 
12040  /**
12041  * \brief Getter for member variable \ref BABlock.statement_block
12042  */
12043  const std::shared_ptr<StatementBlock> &get_statement_block() const
12044  noexcept override {
12045  return statement_block;
12046  }
12047 
12048  /// \}
12049 
12050  /// \name Setters
12051  /// \{
12052 
12053  /**
12054  * \brief Set token for the current ast node
12055  */
12056  void set_token(const ModToken &tok) {
12057  token = std::make_shared<ModToken>(tok);
12058  }
12059 
12060  /**
12061  * \brief Set symbol table for the current ast node
12062  *
12063  * Top level, block scoped nodes store symbol table in the ast node.
12064  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12065  * for every node in the ast.
12066  *
12067  * \sa nmodl::visitor::SymtabVisitor
12068  */
12069  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
12070  symtab = newsymtab;
12071  }
12072 
12073  /**
12074  * \brief Setter for member variable \ref BABlock.type (rvalue reference)
12075  */
12076  void set_type(std::shared_ptr<BABlockType> &&type);
12077 
12078  /**
12079  * \brief Setter for member variable \ref BABlock.type
12080  */
12081  void set_type(const std::shared_ptr<BABlockType> &type);
12082 
12083  /**
12084  * \brief Setter for member variable \ref BABlock.statement_block (rvalue
12085  * reference)
12086  */
12087  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
12088 
12089  /**
12090  * \brief Setter for member variable \ref BABlock.statement_block
12091  */
12092  void
12093  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
12094 
12095  /// \}
12096 
12097  /// \name Visitor
12098  /// \{
12099 
12100  /**
12101  * \brief visit children i.e. member variables of current node using provided
12102  * visitor
12103  *
12104  * Different nodes in the AST have different members (i.e. children). This
12105  * method recursively visits children using provided visitor.
12106  *
12107  * \param v Concrete visitor that will be used to recursively visit children
12108  *
12109  * \sa Ast::visit_children for example.
12110  */
12111  void visit_children(visitor::Visitor &v) override;
12112 
12113  /**
12114  * \brief accept (or visit) the current AST node using provided visitor
12115  *
12116  * Instead of visiting children of AST node, like Ast::visit_children,
12117  * accept allows to visit the current node itself using provided concrete
12118  * visitor.
12119  *
12120  * \param v Concrete visitor that will be used to recursively visit node
12121  *
12122  * \sa Ast::accept for example.
12123  */
12124  void accept(visitor::Visitor &v) override;
12125 
12126  /// \}
12127 
12128 private:
12129  /**
12130  * \brief Set this object as parent for all the children
12131  *
12132  * This should be called in every object (with children) constructor
12133  * to set parents. Since it is called only in the constructors it
12134  * should not be virtual to avoid ambiguities (issue #295).
12135  */
12136  void set_parent_in_children();
12137 };
12138 
12139 /** @} */ // end of ast_class
12140 
12141 } // namespace ast
12142 } // namespace nmodl
12143 #endif // !NMODL_AST_BA_BLOCK_HPP
12144 #ifndef NMODL_AST_FOR_NETCON_HPP
12145 #define NMODL_AST_FOR_NETCON_HPP
12146 
12147 namespace nmodl {
12148 namespace ast {
12149 
12150 /**
12151  * @addtogroup ast_class
12152  * @ingroup ast
12153  * @{
12154  */
12155 
12156 /**
12157  * \brief TODO
12158  *
12159  *
12160  */
12161 class ForNetcon : public Block {
12162 private:
12163  /// Arguments to the for netcon block
12165  /// Block with statements vector
12166  std::shared_ptr<StatementBlock> statement_block;
12167  /// token with location information
12168  std::shared_ptr<ModToken> token;
12169  /// symbol table for a block
12170  symtab::SymbolTable *symtab = nullptr;
12171 
12172 public:
12173  /// \name Ctor & dtor
12174  /// \{
12175 
12176  explicit ForNetcon(ArgumentVector parameters,
12177  StatementBlock *statement_block);
12178  explicit ForNetcon(const ArgumentVector &parameters,
12179  const std::shared_ptr<StatementBlock> &statement_block);
12180  ForNetcon(const ForNetcon &obj);
12181 
12182  virtual ~ForNetcon() = default;
12183 
12184  /// \}
12185 
12186  /**
12187  * \brief Check if the ast node is an instance of ast::ForNetcon
12188  * \return true as object is of type ast::ForNetcon
12189  */
12190  bool is_for_netcon() const noexcept override { return true; }
12191 
12192  /**
12193  * \brief Return a copy of the current node
12194  *
12195  * Recursively make a new copy/clone of the current node including
12196  * all members and return a pointer to the node. This is used for
12197  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12198  * ast.
12199  *
12200  * @return pointer to the clone/copy of the current node
12201  */
12202  ForNetcon *clone() const override { return new ForNetcon(*this); }
12203 
12204  /// \name Getters
12205  /// \{
12206 
12207  /**
12208  * \brief Return type (ast::AstNodeType) of ast node
12209  *
12210  * Every node in the ast has a type defined in ast::AstNodeType and this
12211  * function is used to retrieve the same.
12212  *
12213  * \return ast node type i.e. ast::AstNodeType::FOR_NETCON
12214  *
12215  * \sa Ast::get_node_type_name
12216  */
12217  AstNodeType get_node_type() const noexcept override {
12218  return AstNodeType::FOR_NETCON;
12219  }
12220 
12221  /**
12222  * \brief Return type (ast::AstNodeType) of ast node as std::string
12223  *
12224  * Every node in the ast has a type defined in ast::AstNodeType.
12225  * This type name can be returned as a std::string for printing
12226  * node to text/json form.
12227  *
12228  * \return name of the node type as a string i.e. "ForNetcon"
12229  *
12230  * \sa Ast::get_node_name
12231  */
12232  std::string get_node_type_name() const noexcept override {
12233  return "ForNetcon";
12234  }
12235 
12236  /**
12237  * \brief Return NMODL statement of ast node as std::string
12238  *
12239  * Every node is related to a special statement in the NMODL. This
12240  * statement can be returned as a std::string for printing to
12241  * text/json form.
12242  *
12243  * \return name of the statement as a string i.e. "FOR_NETCONS "
12244  *
12245  * \sa Ast::get_nmodl_name
12246  */
12247  std::string get_nmodl_name() const noexcept override {
12248  return "FOR_NETCONS ";
12249  }
12250 
12251  /**
12252  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12253  */
12254  std::shared_ptr<Ast> get_shared_ptr() override {
12255  return std::static_pointer_cast<ForNetcon>(shared_from_this());
12256  }
12257 
12258  /**
12259  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12260  */
12261  std::shared_ptr<const Ast> get_shared_ptr() const override {
12262  return std::static_pointer_cast<const ForNetcon>(shared_from_this());
12263  }
12264 
12265  /**
12266  * \brief Return associated token for the current ast node
12267  *
12268  * Not all ast nodes have token information. For example,
12269  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
12270  * solution of ODEs. In this case, we return nullptr to store in the
12271  * nmodl::symtab::SymbolTable.
12272  *
12273  * \return pointer to token if exist otherwise nullptr
12274  */
12275  const ModToken *get_token() const noexcept override { return token.get(); }
12276 
12277  /**
12278  * \brief Return associated symbol table for the current ast node
12279  *
12280  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12281  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12282  * and it can be accessed using this method.
12283  *
12284  * \return pointer to the symbol table
12285  *
12286  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12287  */
12288  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
12289 
12290  /**
12291  * \brief Getter for member variable \ref ForNetcon.parameters
12292  */
12293  const ArgumentVector &get_parameters() const noexcept override {
12294  return parameters;
12295  }
12296 
12297  /**
12298  * \brief Getter for member variable \ref ForNetcon.statement_block
12299  */
12300  const std::shared_ptr<StatementBlock> &get_statement_block() const
12301  noexcept override {
12302  return statement_block;
12303  }
12304 
12305  /// \}
12306 
12307  /// \name Setters
12308  /// \{
12309 
12310  /**
12311  * \brief Set token for the current ast node
12312  */
12313  void set_token(const ModToken &tok) {
12314  token = std::make_shared<ModToken>(tok);
12315  }
12316 
12317  /**
12318  * \brief Set symbol table for the current ast node
12319  *
12320  * Top level, block scoped nodes store symbol table in the ast node.
12321  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12322  * for every node in the ast.
12323  *
12324  * \sa nmodl::visitor::SymtabVisitor
12325  */
12326  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
12327  symtab = newsymtab;
12328  }
12329 
12330  /**
12331  * \brief Setter for member variable \ref ForNetcon.parameters (rvalue
12332  * reference)
12333  */
12334  void set_parameters(ArgumentVector &&parameters);
12335 
12336  /**
12337  * \brief Setter for member variable \ref ForNetcon.parameters
12338  */
12339  void set_parameters(const ArgumentVector &parameters);
12340 
12341  /**
12342  * \brief Setter for member variable \ref ForNetcon.statement_block (rvalue
12343  * reference)
12344  */
12345  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
12346 
12347  /**
12348  * \brief Setter for member variable \ref ForNetcon.statement_block
12349  */
12350  void
12351  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
12352 
12353  /// \}
12354 
12355  /// \name Visitor
12356  /// \{
12357 
12358  /**
12359  * \brief visit children i.e. member variables of current node using provided
12360  * visitor
12361  *
12362  * Different nodes in the AST have different members (i.e. children). This
12363  * method recursively visits children using provided visitor.
12364  *
12365  * \param v Concrete visitor that will be used to recursively visit children
12366  *
12367  * \sa Ast::visit_children for example.
12368  */
12369  void visit_children(visitor::Visitor &v) override;
12370 
12371  /**
12372  * \brief accept (or visit) the current AST node using provided visitor
12373  *
12374  * Instead of visiting children of AST node, like Ast::visit_children,
12375  * accept allows to visit the current node itself using provided concrete
12376  * visitor.
12377  *
12378  * \param v Concrete visitor that will be used to recursively visit node
12379  *
12380  * \sa Ast::accept for example.
12381  */
12382  void accept(visitor::Visitor &v) override;
12383 
12384  /// \}
12385 
12386 private:
12387  /**
12388  * \brief Set this object as parent for all the children
12389  *
12390  * This should be called in every object (with children) constructor
12391  * to set parents. Since it is called only in the constructors it
12392  * should not be virtual to avoid ambiguities (issue #295).
12393  */
12394  void set_parent_in_children();
12395 };
12396 
12397 /** @} */ // end of ast_class
12398 
12399 } // namespace ast
12400 } // namespace nmodl
12401 #endif // !NMODL_AST_FOR_NETCON_HPP
12402 #ifndef NMODL_AST_KINETIC_BLOCK_HPP
12403 #define NMODL_AST_KINETIC_BLOCK_HPP
12404 
12405 namespace nmodl {
12406 namespace ast {
12407 
12408 /**
12409  * @addtogroup ast_class
12410  * @ingroup ast
12411  * @{
12412  */
12413 
12414 /**
12415  * \brief TODO
12416  *
12417  *
12418  */
12419 class KineticBlock : public Block {
12420 private:
12421  /// Name of the kinetic block
12422  std::shared_ptr<Name> name;
12423  /// Solve for specification (TODO)
12425  /// Block with statements vector
12426  std::shared_ptr<StatementBlock> statement_block;
12427  /// token with location information
12428  std::shared_ptr<ModToken> token;
12429  /// symbol table for a block
12430  symtab::SymbolTable *symtab = nullptr;
12431 
12432 public:
12433  /// \name Ctor & dtor
12434  /// \{
12435 
12436  explicit KineticBlock(Name *name, NameVector solvefor,
12437  StatementBlock *statement_block);
12438  explicit KineticBlock(const std::shared_ptr<Name> &name,
12439  const NameVector &solvefor,
12440  const std::shared_ptr<StatementBlock> &statement_block);
12441  KineticBlock(const KineticBlock &obj);
12442 
12443  virtual ~KineticBlock() = default;
12444 
12445  /// \}
12446 
12447  /**
12448  * \brief Check if the ast node is an instance of ast::KineticBlock
12449  * \return true as object is of type ast::KineticBlock
12450  */
12451  bool is_kinetic_block() const noexcept override { return true; }
12452 
12453  /**
12454  * \brief Return a copy of the current node
12455  *
12456  * Recursively make a new copy/clone of the current node including
12457  * all members and return a pointer to the node. This is used for
12458  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12459  * ast.
12460  *
12461  * @return pointer to the clone/copy of the current node
12462  */
12463  KineticBlock *clone() const override { return new KineticBlock(*this); }
12464 
12465  /// \name Getters
12466  /// \{
12467 
12468  /**
12469  * \brief Return type (ast::AstNodeType) of ast node
12470  *
12471  * Every node in the ast has a type defined in ast::AstNodeType and this
12472  * function is used to retrieve the same.
12473  *
12474  * \return ast node type i.e. ast::AstNodeType::KINETIC_BLOCK
12475  *
12476  * \sa Ast::get_node_type_name
12477  */
12478  AstNodeType get_node_type() const noexcept override {
12480  }
12481 
12482  /**
12483  * \brief Return type (ast::AstNodeType) of ast node as std::string
12484  *
12485  * Every node in the ast has a type defined in ast::AstNodeType.
12486  * This type name can be returned as a std::string for printing
12487  * node to text/json form.
12488  *
12489  * \return name of the node type as a string i.e. "KineticBlock"
12490  *
12491  * \sa Ast::get_node_name
12492  */
12493  std::string get_node_type_name() const noexcept override {
12494  return "KineticBlock";
12495  }
12496 
12497  /**
12498  * \brief Return NMODL statement of ast node as std::string
12499  *
12500  * Every node is related to a special statement in the NMODL. This
12501  * statement can be returned as a std::string for printing to
12502  * text/json form.
12503  *
12504  * \return name of the statement as a string i.e. "KINETIC "
12505  *
12506  * \sa Ast::get_nmodl_name
12507  */
12508  std::string get_nmodl_name() const noexcept override { return "KINETIC "; }
12509 
12510  /**
12511  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12512  */
12513  std::shared_ptr<Ast> get_shared_ptr() override {
12514  return std::static_pointer_cast<KineticBlock>(shared_from_this());
12515  }
12516 
12517  /**
12518  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12519  */
12520  std::shared_ptr<const Ast> get_shared_ptr() const override {
12521  return std::static_pointer_cast<const KineticBlock>(shared_from_this());
12522  }
12523 
12524  /**
12525  * \brief Return associated token for the current ast node
12526  *
12527  * Not all ast nodes have token information. For example,
12528  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
12529  * solution of ODEs. In this case, we return nullptr to store in the
12530  * nmodl::symtab::SymbolTable.
12531  *
12532  * \return pointer to token if exist otherwise nullptr
12533  */
12534  const ModToken *get_token() const noexcept override { return token.get(); }
12535 
12536  /**
12537  * \brief Return associated symbol table for the current ast node
12538  *
12539  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12540  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12541  * and it can be accessed using this method.
12542  *
12543  * \return pointer to the symbol table
12544  *
12545  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12546  */
12547  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
12548 
12549  /**
12550  * \brief Return name of the node
12551  *
12552  * Some ast nodes have a member marked designated as node name. For example,
12553  * in case of this ast::Name has name designated as a
12554  * node name.
12555  *
12556  * @return name of the node as std::string
12557  *
12558  * \sa Ast::get_node_type_name
12559  */
12560  std::string get_node_name() const override;
12561 
12562  /**
12563  * \brief Getter for member variable \ref KineticBlock.name
12564  */
12565  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
12566 
12567  /**
12568  * \brief Getter for member variable \ref KineticBlock.solvefor
12569  */
12570  const NameVector &get_solvefor() const noexcept { return solvefor; }
12571 
12572  /**
12573  * \brief Getter for member variable \ref KineticBlock.statement_block
12574  */
12575  const std::shared_ptr<StatementBlock> &get_statement_block() const
12576  noexcept override {
12577  return statement_block;
12578  }
12579 
12580  /// \}
12581 
12582  /// \name Setters
12583  /// \{
12584 
12585  /**
12586  * \brief Set token for the current ast node
12587  */
12588  void set_token(const ModToken &tok) {
12589  token = std::make_shared<ModToken>(tok);
12590  }
12591 
12592  /**
12593  * \brief Set symbol table for the current ast node
12594  *
12595  * Top level, block scoped nodes store symbol table in the ast node.
12596  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12597  * for every node in the ast.
12598  *
12599  * \sa nmodl::visitor::SymtabVisitor
12600  */
12601  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
12602  symtab = newsymtab;
12603  }
12604 
12605  /**
12606  * \brief Setter for member variable \ref KineticBlock.name (rvalue reference)
12607  */
12608  void set_name(std::shared_ptr<Name> &&name);
12609 
12610  /**
12611  * \brief Setter for member variable \ref KineticBlock.name
12612  */
12613  void set_name(const std::shared_ptr<Name> &name);
12614 
12615  /**
12616  * \brief Setter for member variable \ref KineticBlock.solvefor (rvalue
12617  * reference)
12618  */
12619  void set_solvefor(NameVector &&solvefor);
12620 
12621  /**
12622  * \brief Setter for member variable \ref KineticBlock.solvefor
12623  */
12624  void set_solvefor(const NameVector &solvefor);
12625 
12626  /**
12627  * \brief Setter for member variable \ref KineticBlock.statement_block (rvalue
12628  * reference)
12629  */
12630  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
12631 
12632  /**
12633  * \brief Setter for member variable \ref KineticBlock.statement_block
12634  */
12635  void
12636  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
12637 
12638  /// \}
12639 
12640  /// \name Visitor
12641  /// \{
12642 
12643  /**
12644  * \brief visit children i.e. member variables of current node using provided
12645  * visitor
12646  *
12647  * Different nodes in the AST have different members (i.e. children). This
12648  * method recursively visits children using provided visitor.
12649  *
12650  * \param v Concrete visitor that will be used to recursively visit children
12651  *
12652  * \sa Ast::visit_children for example.
12653  */
12654  void visit_children(visitor::Visitor &v) override;
12655 
12656  /**
12657  * \brief accept (or visit) the current AST node using provided visitor
12658  *
12659  * Instead of visiting children of AST node, like Ast::visit_children,
12660  * accept allows to visit the current node itself using provided concrete
12661  * visitor.
12662  *
12663  * \param v Concrete visitor that will be used to recursively visit node
12664  *
12665  * \sa Ast::accept for example.
12666  */
12667  void accept(visitor::Visitor &v) override;
12668 
12669  /// \}
12670 
12671 private:
12672  /**
12673  * \brief Set this object as parent for all the children
12674  *
12675  * This should be called in every object (with children) constructor
12676  * to set parents. Since it is called only in the constructors it
12677  * should not be virtual to avoid ambiguities (issue #295).
12678  */
12679  void set_parent_in_children();
12680 };
12681 
12682 /** @} */ // end of ast_class
12683 
12684 } // namespace ast
12685 } // namespace nmodl
12686 #endif // !NMODL_AST_KINETIC_BLOCK_HPP
12687 #ifndef NMODL_AST_MATCH_BLOCK_HPP
12688 #define NMODL_AST_MATCH_BLOCK_HPP
12689 
12690 namespace nmodl {
12691 namespace ast {
12692 
12693 /**
12694  * @addtogroup ast_class
12695  * @ingroup ast
12696  * @{
12697  */
12698 
12699 /**
12700  * \brief TODO
12701  *
12702  *
12703  */
12704 class MatchBlock : public Block {
12705 private:
12706  /// Vector of match statements
12708  /// token with location information
12709  std::shared_ptr<ModToken> token;
12710  /// symbol table for a block
12711  symtab::SymbolTable *symtab = nullptr;
12712 
12713 public:
12714  /// \name Ctor & dtor
12715  /// \{
12716 
12717  explicit MatchBlock(MatchVector matchs);
12718  MatchBlock(const MatchBlock &obj);
12719 
12720  virtual ~MatchBlock() = default;
12721 
12722  /// \}
12723 
12724  /**
12725  * \brief Check if the ast node is an instance of ast::MatchBlock
12726  * \return true as object is of type ast::MatchBlock
12727  */
12728  bool is_match_block() const noexcept override { return true; }
12729 
12730  /**
12731  * \brief Return a copy of the current node
12732  *
12733  * Recursively make a new copy/clone of the current node including
12734  * all members and return a pointer to the node. This is used for
12735  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12736  * ast.
12737  *
12738  * @return pointer to the clone/copy of the current node
12739  */
12740  MatchBlock *clone() const override { return new MatchBlock(*this); }
12741 
12742  /// \name Getters
12743  /// \{
12744 
12745  /**
12746  * \brief Return type (ast::AstNodeType) of ast node
12747  *
12748  * Every node in the ast has a type defined in ast::AstNodeType and this
12749  * function is used to retrieve the same.
12750  *
12751  * \return ast node type i.e. ast::AstNodeType::MATCH_BLOCK
12752  *
12753  * \sa Ast::get_node_type_name
12754  */
12755  AstNodeType get_node_type() const noexcept override {
12756  return AstNodeType::MATCH_BLOCK;
12757  }
12758 
12759  /**
12760  * \brief Return type (ast::AstNodeType) of ast node as std::string
12761  *
12762  * Every node in the ast has a type defined in ast::AstNodeType.
12763  * This type name can be returned as a std::string for printing
12764  * node to text/json form.
12765  *
12766  * \return name of the node type as a string i.e. "MatchBlock"
12767  *
12768  * \sa Ast::get_node_name
12769  */
12770  std::string get_node_type_name() const noexcept override {
12771  return "MatchBlock";
12772  }
12773 
12774  /**
12775  * \brief Return NMODL statement of ast node as std::string
12776  *
12777  * Every node is related to a special statement in the NMODL. This
12778  * statement can be returned as a std::string for printing to
12779  * text/json form.
12780  *
12781  * \return name of the statement as a string i.e. "MATCH"
12782  *
12783  * \sa Ast::get_nmodl_name
12784  */
12785  std::string get_nmodl_name() const noexcept override { return "MATCH"; }
12786 
12787  /**
12788  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12789  */
12790  std::shared_ptr<Ast> get_shared_ptr() override {
12791  return std::static_pointer_cast<MatchBlock>(shared_from_this());
12792  }
12793 
12794  /**
12795  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12796  */
12797  std::shared_ptr<const Ast> get_shared_ptr() const override {
12798  return std::static_pointer_cast<const MatchBlock>(shared_from_this());
12799  }
12800 
12801  /**
12802  * \brief Return associated token for the current ast node
12803  *
12804  * Not all ast nodes have token information. For example,
12805  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
12806  * solution of ODEs. In this case, we return nullptr to store in the
12807  * nmodl::symtab::SymbolTable.
12808  *
12809  * \return pointer to token if exist otherwise nullptr
12810  */
12811  const ModToken *get_token() const noexcept override { return token.get(); }
12812 
12813  /**
12814  * \brief Return associated symbol table for the current ast node
12815  *
12816  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12817  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12818  * and it can be accessed using this method.
12819  *
12820  * \return pointer to the symbol table
12821  *
12822  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12823  */
12824  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
12825 
12826  /**
12827  * \brief Getter for member variable \ref MatchBlock.matchs
12828  */
12829  const MatchVector &get_matchs() const noexcept { return matchs; }
12830 
12831  /// \}
12832 
12833  /// \name Setters
12834  /// \{
12835 
12836  /**
12837  * \brief Set token for the current ast node
12838  */
12839  void set_token(const ModToken &tok) {
12840  token = std::make_shared<ModToken>(tok);
12841  }
12842 
12843  /**
12844  * \brief Set symbol table for the current ast node
12845  *
12846  * Top level, block scoped nodes store symbol table in the ast node.
12847  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12848  * for every node in the ast.
12849  *
12850  * \sa nmodl::visitor::SymtabVisitor
12851  */
12852  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
12853  symtab = newsymtab;
12854  }
12855 
12856  /**
12857  * \brief Setter for member variable \ref MatchBlock.matchs (rvalue reference)
12858  */
12859  void set_matchs(MatchVector &&matchs);
12860 
12861  /**
12862  * \brief Setter for member variable \ref MatchBlock.matchs
12863  */
12864  void set_matchs(const MatchVector &matchs);
12865 
12866  /// \}
12867 
12868  /// \name Visitor
12869  /// \{
12870 
12871  /**
12872  * \brief visit children i.e. member variables of current node using provided
12873  * visitor
12874  *
12875  * Different nodes in the AST have different members (i.e. children). This
12876  * method recursively visits children using provided visitor.
12877  *
12878  * \param v Concrete visitor that will be used to recursively visit children
12879  *
12880  * \sa Ast::visit_children for example.
12881  */
12882  void visit_children(visitor::Visitor &v) override;
12883 
12884  /**
12885  * \brief accept (or visit) the current AST node using provided visitor
12886  *
12887  * Instead of visiting children of AST node, like Ast::visit_children,
12888  * accept allows to visit the current node itself using provided concrete
12889  * visitor.
12890  *
12891  * \param v Concrete visitor that will be used to recursively visit node
12892  *
12893  * \sa Ast::accept for example.
12894  */
12895  void accept(visitor::Visitor &v) override;
12896 
12897  /// \}
12898 
12899 private:
12900  /**
12901  * \brief Set this object as parent for all the children
12902  *
12903  * This should be called in every object (with children) constructor
12904  * to set parents. Since it is called only in the constructors it
12905  * should not be virtual to avoid ambiguities (issue #295).
12906  */
12907  void set_parent_in_children();
12908 };
12909 
12910 /** @} */ // end of ast_class
12911 
12912 } // namespace ast
12913 } // namespace nmodl
12914 #endif // !NMODL_AST_MATCH_BLOCK_HPP
12915 #ifndef NMODL_AST_UNIT_BLOCK_HPP
12916 #define NMODL_AST_UNIT_BLOCK_HPP
12917 
12918 namespace nmodl {
12919 namespace ast {
12920 
12921 /**
12922  * @addtogroup ast_class
12923  * @ingroup ast
12924  * @{
12925  */
12926 
12927 /**
12928  * \brief TODO
12929  *
12930  *
12931  */
12932 class UnitBlock : public Block {
12933 private:
12934  /// Vector of unit statements
12936  /// token with location information
12937  std::shared_ptr<ModToken> token;
12938  /// symbol table for a block
12939  symtab::SymbolTable *symtab = nullptr;
12940 
12941 public:
12942  /// \name Ctor & dtor
12943  /// \{
12944 
12945  explicit UnitBlock(ExpressionVector definitions);
12946  UnitBlock(const UnitBlock &obj);
12947 
12948  virtual ~UnitBlock() = default;
12949 
12950  /// \}
12951 
12952  /**
12953  * \brief Check if the ast node is an instance of ast::UnitBlock
12954  * \return true as object is of type ast::UnitBlock
12955  */
12956  bool is_unit_block() const noexcept override { return true; }
12957 
12958  /**
12959  * \brief Return a copy of the current node
12960  *
12961  * Recursively make a new copy/clone of the current node including
12962  * all members and return a pointer to the node. This is used for
12963  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12964  * ast.
12965  *
12966  * @return pointer to the clone/copy of the current node
12967  */
12968  UnitBlock *clone() const override { return new UnitBlock(*this); }
12969 
12970  /// \name Getters
12971  /// \{
12972 
12973  /**
12974  * \brief Return type (ast::AstNodeType) of ast node
12975  *
12976  * Every node in the ast has a type defined in ast::AstNodeType and this
12977  * function is used to retrieve the same.
12978  *
12979  * \return ast node type i.e. ast::AstNodeType::UNIT_BLOCK
12980  *
12981  * \sa Ast::get_node_type_name
12982  */
12983  AstNodeType get_node_type() const noexcept override {
12984  return AstNodeType::UNIT_BLOCK;
12985  }
12986 
12987  /**
12988  * \brief Return type (ast::AstNodeType) of ast node as std::string
12989  *
12990  * Every node in the ast has a type defined in ast::AstNodeType.
12991  * This type name can be returned as a std::string for printing
12992  * node to text/json form.
12993  *
12994  * \return name of the node type as a string i.e. "UnitBlock"
12995  *
12996  * \sa Ast::get_node_name
12997  */
12998  std::string get_node_type_name() const noexcept override {
12999  return "UnitBlock";
13000  }
13001 
13002  /**
13003  * \brief Return NMODL statement of ast node as std::string
13004  *
13005  * Every node is related to a special statement in the NMODL. This
13006  * statement can be returned as a std::string for printing to
13007  * text/json form.
13008  *
13009  * \return name of the statement as a string i.e. "UNITS "
13010  *
13011  * \sa Ast::get_nmodl_name
13012  */
13013  std::string get_nmodl_name() const noexcept override { return "UNITS "; }
13014 
13015  /**
13016  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13017  */
13018  std::shared_ptr<Ast> get_shared_ptr() override {
13019  return std::static_pointer_cast<UnitBlock>(shared_from_this());
13020  }
13021 
13022  /**
13023  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13024  */
13025  std::shared_ptr<const Ast> get_shared_ptr() const override {
13026  return std::static_pointer_cast<const UnitBlock>(shared_from_this());
13027  }
13028 
13029  /**
13030  * \brief Return associated token for the current ast node
13031  *
13032  * Not all ast nodes have token information. For example,
13033  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
13034  * solution of ODEs. In this case, we return nullptr to store in the
13035  * nmodl::symtab::SymbolTable.
13036  *
13037  * \return pointer to token if exist otherwise nullptr
13038  */
13039  const ModToken *get_token() const noexcept override { return token.get(); }
13040 
13041  /**
13042  * \brief Return associated symbol table for the current ast node
13043  *
13044  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13045  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13046  * and it can be accessed using this method.
13047  *
13048  * \return pointer to the symbol table
13049  *
13050  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13051  */
13052  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
13053 
13054  /**
13055  * \brief Getter for member variable \ref UnitBlock.definitions
13056  */
13057  const ExpressionVector &get_definitions() const noexcept {
13058  return definitions;
13059  }
13060 
13061  /// \}
13062 
13063  /// \name Setters
13064  /// \{
13065 
13066  /**
13067  * \brief Set token for the current ast node
13068  */
13069  void set_token(const ModToken &tok) {
13070  token = std::make_shared<ModToken>(tok);
13071  }
13072 
13073  /**
13074  * \brief Set symbol table for the current ast node
13075  *
13076  * Top level, block scoped nodes store symbol table in the ast node.
13077  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13078  * for every node in the ast.
13079  *
13080  * \sa nmodl::visitor::SymtabVisitor
13081  */
13082  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
13083  symtab = newsymtab;
13084  }
13085 
13086  /**
13087  * \brief Setter for member variable \ref UnitBlock.definitions (rvalue
13088  * reference)
13089  */
13090  void set_definitions(ExpressionVector &&definitions);
13091 
13092  /**
13093  * \brief Setter for member variable \ref UnitBlock.definitions
13094  */
13095  void set_definitions(const ExpressionVector &definitions);
13096 
13097  /// \}
13098 
13099  /// \name Visitor
13100  /// \{
13101 
13102  /**
13103  * \brief visit children i.e. member variables of current node using provided
13104  * visitor
13105  *
13106  * Different nodes in the AST have different members (i.e. children). This
13107  * method recursively visits children using provided visitor.
13108  *
13109  * \param v Concrete visitor that will be used to recursively visit children
13110  *
13111  * \sa Ast::visit_children for example.
13112  */
13113  void visit_children(visitor::Visitor &v) override;
13114 
13115  /**
13116  * \brief accept (or visit) the current AST node using provided visitor
13117  *
13118  * Instead of visiting children of AST node, like Ast::visit_children,
13119  * accept allows to visit the current node itself using provided concrete
13120  * visitor.
13121  *
13122  * \param v Concrete visitor that will be used to recursively visit node
13123  *
13124  * \sa Ast::accept for example.
13125  */
13126  void accept(visitor::Visitor &v) override;
13127 
13128  /// \}
13129 
13130 private:
13131  /**
13132  * \brief Set this object as parent for all the children
13133  *
13134  * This should be called in every object (with children) constructor
13135  * to set parents. Since it is called only in the constructors it
13136  * should not be virtual to avoid ambiguities (issue #295).
13137  */
13138  void set_parent_in_children();
13139 };
13140 
13141 /** @} */ // end of ast_class
13142 
13143 } // namespace ast
13144 } // namespace nmodl
13145 #endif // !NMODL_AST_UNIT_BLOCK_HPP
13146 #ifndef NMODL_AST_CONSTANT_BLOCK_HPP
13147 #define NMODL_AST_CONSTANT_BLOCK_HPP
13148 
13149 namespace nmodl {
13150 namespace ast {
13151 
13152 /**
13153  * @addtogroup ast_class
13154  * @ingroup ast
13155  * @{
13156  */
13157 
13158 /**
13159  * \brief Represent `CONSTANT` block in the mod file
13160  *
13161  * Here is an example of `CONSTANT` block in mod file:
13162  *
13163  * \code{.mod}
13164  * CONSTANT {
13165  * q10 = 3
13166  *
13167  * cvm = 28.9 (mV)
13168  * ckm = 6.2 (mV)
13169  * ctm = 0.000505 (s)
13170  * }
13171  * \endcode
13172  *
13173  */
13174 class ConstantBlock : public Block {
13175 private:
13176  /// Vector of constant statements
13178  /// token with location information
13179  std::shared_ptr<ModToken> token;
13180  /// symbol table for a block
13181  symtab::SymbolTable *symtab = nullptr;
13182 
13183 public:
13184  /// \name Ctor & dtor
13185  /// \{
13186 
13187  explicit ConstantBlock(ConstantStatementVector statements);
13188  ConstantBlock(const ConstantBlock &obj);
13189 
13190  virtual ~ConstantBlock() = default;
13191 
13192  /// \}
13193 
13194  /**
13195  * \brief Check if the ast node is an instance of ast::ConstantBlock
13196  * \return true as object is of type ast::ConstantBlock
13197  */
13198  bool is_constant_block() const noexcept override { return true; }
13199 
13200  /**
13201  * \brief Return a copy of the current node
13202  *
13203  * Recursively make a new copy/clone of the current node including
13204  * all members and return a pointer to the node. This is used for
13205  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13206  * ast.
13207  *
13208  * @return pointer to the clone/copy of the current node
13209  */
13210  ConstantBlock *clone() const override { return new ConstantBlock(*this); }
13211 
13212  /// \name Getters
13213  /// \{
13214 
13215  /**
13216  * \brief Return type (ast::AstNodeType) of ast node
13217  *
13218  * Every node in the ast has a type defined in ast::AstNodeType and this
13219  * function is used to retrieve the same.
13220  *
13221  * \return ast node type i.e. ast::AstNodeType::CONSTANT_BLOCK
13222  *
13223  * \sa Ast::get_node_type_name
13224  */
13225  AstNodeType get_node_type() const noexcept override {
13227  }
13228 
13229  /**
13230  * \brief Return type (ast::AstNodeType) of ast node as std::string
13231  *
13232  * Every node in the ast has a type defined in ast::AstNodeType.
13233  * This type name can be returned as a std::string for printing
13234  * node to text/json form.
13235  *
13236  * \return name of the node type as a string i.e. "ConstantBlock"
13237  *
13238  * \sa Ast::get_node_name
13239  */
13240  std::string get_node_type_name() const noexcept override {
13241  return "ConstantBlock";
13242  }
13243 
13244  /**
13245  * \brief Return NMODL statement of ast node as std::string
13246  *
13247  * Every node is related to a special statement in the NMODL. This
13248  * statement can be returned as a std::string for printing to
13249  * text/json form.
13250  *
13251  * \return name of the statement as a string i.e. "CONSTANT "
13252  *
13253  * \sa Ast::get_nmodl_name
13254  */
13255  std::string get_nmodl_name() const noexcept override { return "CONSTANT "; }
13256 
13257  /**
13258  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13259  */
13260  std::shared_ptr<Ast> get_shared_ptr() override {
13261  return std::static_pointer_cast<ConstantBlock>(shared_from_this());
13262  }
13263 
13264  /**
13265  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13266  */
13267  std::shared_ptr<const Ast> get_shared_ptr() const override {
13268  return std::static_pointer_cast<const ConstantBlock>(shared_from_this());
13269  }
13270 
13271  /**
13272  * \brief Return associated token for the current ast node
13273  *
13274  * Not all ast nodes have token information. For example,
13275  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
13276  * solution of ODEs. In this case, we return nullptr to store in the
13277  * nmodl::symtab::SymbolTable.
13278  *
13279  * \return pointer to token if exist otherwise nullptr
13280  */
13281  const ModToken *get_token() const noexcept override { return token.get(); }
13282 
13283  /**
13284  * \brief Return associated symbol table for the current ast node
13285  *
13286  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13287  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13288  * and it can be accessed using this method.
13289  *
13290  * \return pointer to the symbol table
13291  *
13292  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13293  */
13294  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
13295 
13296  /**
13297  * \brief Getter for member variable \ref ConstantBlock.statements
13298  */
13299  const ConstantStatementVector &get_statements() const noexcept {
13300  return statements;
13301  }
13302 
13303  /// \}
13304 
13305  /// \name Setters
13306  /// \{
13307 
13308  /**
13309  * \brief Set token for the current ast node
13310  */
13311  void set_token(const ModToken &tok) {
13312  token = std::make_shared<ModToken>(tok);
13313  }
13314 
13315  /**
13316  * \brief Set symbol table for the current ast node
13317  *
13318  * Top level, block scoped nodes store symbol table in the ast node.
13319  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13320  * for every node in the ast.
13321  *
13322  * \sa nmodl::visitor::SymtabVisitor
13323  */
13324  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
13325  symtab = newsymtab;
13326  }
13327 
13328  /**
13329  * \brief Setter for member variable \ref ConstantBlock.statements (rvalue
13330  * reference)
13331  */
13332  void set_statements(ConstantStatementVector &&statements);
13333 
13334  /**
13335  * \brief Setter for member variable \ref ConstantBlock.statements
13336  */
13337  void set_statements(const ConstantStatementVector &statements);
13338 
13339  /// \}
13340 
13341  /// \name Visitor
13342  /// \{
13343 
13344  /**
13345  * \brief visit children i.e. member variables of current node using provided
13346  * visitor
13347  *
13348  * Different nodes in the AST have different members (i.e. children). This
13349  * method recursively visits children using provided visitor.
13350  *
13351  * \param v Concrete visitor that will be used to recursively visit children
13352  *
13353  * \sa Ast::visit_children for example.
13354  */
13355  void visit_children(visitor::Visitor &v) override;
13356 
13357  /**
13358  * \brief accept (or visit) the current AST node using provided visitor
13359  *
13360  * Instead of visiting children of AST node, like Ast::visit_children,
13361  * accept allows to visit the current node itself using provided concrete
13362  * visitor.
13363  *
13364  * \param v Concrete visitor that will be used to recursively visit node
13365  *
13366  * \sa Ast::accept for example.
13367  */
13368  void accept(visitor::Visitor &v) override;
13369 
13370  /// \}
13371 
13372 private:
13373  /**
13374  * \brief Set this object as parent for all the children
13375  *
13376  * This should be called in every object (with children) constructor
13377  * to set parents. Since it is called only in the constructors it
13378  * should not be virtual to avoid ambiguities (issue #295).
13379  */
13380  void set_parent_in_children();
13381 };
13382 
13383 /** @} */ // end of ast_class
13384 
13385 } // namespace ast
13386 } // namespace nmodl
13387 #endif // !NMODL_AST_CONSTANT_BLOCK_HPP
13388 #ifndef NMODL_AST_NEURON_BLOCK_HPP
13389 #define NMODL_AST_NEURON_BLOCK_HPP
13390 
13391 namespace nmodl {
13392 namespace ast {
13393 
13394 /**
13395  * @addtogroup ast_class
13396  * @ingroup ast
13397  * @{
13398  */
13399 
13400 /**
13401  * \brief Represent `NEURON` block in the mod file
13402  *
13403  * The keyword `NEURON` introduces a special block which contains statements
13404  * that tell NMODL how to organize the variables for access at the NEURON user
13405  * level. Here is an example of `NEURON` block from `HH` channel:
13406  *
13407  * \code{.mod}
13408  * NEURON {
13409  * SUFFIX hh
13410  * USEION na READ ena WRITE ina
13411  * USEION k READ ek WRITE ik
13412  * NONSPECIFIC_CURRENT il
13413  * RANGE gnabar, gkbar, gl, el, gna, gk
13414  * RANGE minf, hinf, ninf, mtau, htau, ntau
13415  * THREADSAFE
13416  * }
13417  * \endcode
13418  *
13419  */
13420 class NeuronBlock : public Block {
13421 private:
13422  /// Block with statements vector
13423  std::shared_ptr<StatementBlock> statement_block;
13424  /// token with location information
13425  std::shared_ptr<ModToken> token;
13426  /// symbol table for a block
13427  symtab::SymbolTable *symtab = nullptr;
13428 
13429 public:
13430  /// \name Ctor & dtor
13431  /// \{
13432 
13433  explicit NeuronBlock(StatementBlock *statement_block);
13434  explicit NeuronBlock(const std::shared_ptr<StatementBlock> &statement_block);
13435  NeuronBlock(const NeuronBlock &obj);
13436 
13437  virtual ~NeuronBlock() = default;
13438 
13439  /// \}
13440 
13441  /**
13442  * \brief Check if the ast node is an instance of ast::NeuronBlock
13443  * \return true as object is of type ast::NeuronBlock
13444  */
13445  bool is_neuron_block() const noexcept override { return true; }
13446 
13447  /**
13448  * \brief Return a copy of the current node
13449  *
13450  * Recursively make a new copy/clone of the current node including
13451  * all members and return a pointer to the node. This is used for
13452  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13453  * ast.
13454  *
13455  * @return pointer to the clone/copy of the current node
13456  */
13457  NeuronBlock *clone() const override { return new NeuronBlock(*this); }
13458 
13459  /// \name Getters
13460  /// \{
13461 
13462  /**
13463  * \brief Return type (ast::AstNodeType) of ast node
13464  *
13465  * Every node in the ast has a type defined in ast::AstNodeType and this
13466  * function is used to retrieve the same.
13467  *
13468  * \return ast node type i.e. ast::AstNodeType::NEURON_BLOCK
13469  *
13470  * \sa Ast::get_node_type_name
13471  */
13472  AstNodeType get_node_type() const noexcept override {
13474  }
13475 
13476  /**
13477  * \brief Return type (ast::AstNodeType) of ast node as std::string
13478  *
13479  * Every node in the ast has a type defined in ast::AstNodeType.
13480  * This type name can be returned as a std::string for printing
13481  * node to text/json form.
13482  *
13483  * \return name of the node type as a string i.e. "NeuronBlock"
13484  *
13485  * \sa Ast::get_node_name
13486  */
13487  std::string get_node_type_name() const noexcept override {
13488  return "NeuronBlock";
13489  }
13490 
13491  /**
13492  * \brief Return NMODL statement of ast node as std::string
13493  *
13494  * Every node is related to a special statement in the NMODL. This
13495  * statement can be returned as a std::string for printing to
13496  * text/json form.
13497  *
13498  * \return name of the statement as a string i.e. "NEURON "
13499  *
13500  * \sa Ast::get_nmodl_name
13501  */
13502  std::string get_nmodl_name() const noexcept override { return "NEURON "; }
13503 
13504  /**
13505  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13506  */
13507  std::shared_ptr<Ast> get_shared_ptr() override {
13508  return std::static_pointer_cast<NeuronBlock>(shared_from_this());
13509  }
13510 
13511  /**
13512  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13513  */
13514  std::shared_ptr<const Ast> get_shared_ptr() const override {
13515  return std::static_pointer_cast<const NeuronBlock>(shared_from_this());
13516  }
13517 
13518  /**
13519  * \brief Return associated token for the current ast node
13520  *
13521  * Not all ast nodes have token information. For example,
13522  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
13523  * solution of ODEs. In this case, we return nullptr to store in the
13524  * nmodl::symtab::SymbolTable.
13525  *
13526  * \return pointer to token if exist otherwise nullptr
13527  */
13528  const ModToken *get_token() const noexcept override { return token.get(); }
13529 
13530  /**
13531  * \brief Return associated symbol table for the current ast node
13532  *
13533  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13534  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13535  * and it can be accessed using this method.
13536  *
13537  * \return pointer to the symbol table
13538  *
13539  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13540  */
13541  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
13542 
13543  /**
13544  * \brief Getter for member variable \ref NeuronBlock.statement_block
13545  */
13546  const std::shared_ptr<StatementBlock> &get_statement_block() const
13547  noexcept override {
13548  return statement_block;
13549  }
13550 
13551  /// \}
13552 
13553  /// \name Setters
13554  /// \{
13555 
13556  /**
13557  * \brief Set token for the current ast node
13558  */
13559  void set_token(const ModToken &tok) {
13560  token = std::make_shared<ModToken>(tok);
13561  }
13562 
13563  /**
13564  * \brief Set symbol table for the current ast node
13565  *
13566  * Top level, block scoped nodes store symbol table in the ast node.
13567  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13568  * for every node in the ast.
13569  *
13570  * \sa nmodl::visitor::SymtabVisitor
13571  */
13572  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
13573  symtab = newsymtab;
13574  }
13575 
13576  /**
13577  * \brief Setter for member variable \ref NeuronBlock.statement_block (rvalue
13578  * reference)
13579  */
13580  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
13581 
13582  /**
13583  * \brief Setter for member variable \ref NeuronBlock.statement_block
13584  */
13585  void
13586  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
13587 
13588  /// \}
13589 
13590  /// \name Visitor
13591  /// \{
13592 
13593  /**
13594  * \brief visit children i.e. member variables of current node using provided
13595  * visitor
13596  *
13597  * Different nodes in the AST have different members (i.e. children). This
13598  * method recursively visits children using provided visitor.
13599  *
13600  * \param v Concrete visitor that will be used to recursively visit children
13601  *
13602  * \sa Ast::visit_children for example.
13603  */
13604  void visit_children(visitor::Visitor &v) override;
13605 
13606  /**
13607  * \brief accept (or visit) the current AST node using provided visitor
13608  *
13609  * Instead of visiting children of AST node, like Ast::visit_children,
13610  * accept allows to visit the current node itself using provided concrete
13611  * visitor.
13612  *
13613  * \param v Concrete visitor that will be used to recursively visit node
13614  *
13615  * \sa Ast::accept for example.
13616  */
13617  void accept(visitor::Visitor &v) override;
13618 
13619  /// \}
13620 
13621 private:
13622  /**
13623  * \brief Set this object as parent for all the children
13624  *
13625  * This should be called in every object (with children) constructor
13626  * to set parents. Since it is called only in the constructors it
13627  * should not be virtual to avoid ambiguities (issue #295).
13628  */
13629  void set_parent_in_children();
13630 };
13631 
13632 /** @} */ // end of ast_class
13633 
13634 } // namespace ast
13635 } // namespace nmodl
13636 #endif // !NMODL_AST_NEURON_BLOCK_HPP
13637 #ifndef NMODL_AST_UNIT_HPP
13638 #define NMODL_AST_UNIT_HPP
13639 
13640 namespace nmodl {
13641 namespace ast {
13642 
13643 /**
13644  * @addtogroup ast_class
13645  * @ingroup ast
13646  * @{
13647  */
13648 
13649 /**
13650  * \brief TODO
13651  *
13652  *
13653  */
13654 class Unit : public Expression {
13655 private:
13656  /// TODO
13657  std::shared_ptr<String> name;
13658  /// token with location information
13659  std::shared_ptr<ModToken> token;
13660 
13661 public:
13662  /// \name Ctor & dtor
13663  /// \{
13664 
13665  explicit Unit(String *name);
13666  explicit Unit(const std::shared_ptr<String> &name);
13667  Unit(const Unit &obj);
13668 
13669  virtual ~Unit() = default;
13670 
13671  /// \}
13672 
13673  /**
13674  * \brief Check if the ast node is an instance of ast::Unit
13675  * \return true as object is of type ast::Unit
13676  */
13677  bool is_unit() const noexcept override { return true; }
13678 
13679  /**
13680  * \brief Return a copy of the current node
13681  *
13682  * Recursively make a new copy/clone of the current node including
13683  * all members and return a pointer to the node. This is used for
13684  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13685  * ast.
13686  *
13687  * @return pointer to the clone/copy of the current node
13688  */
13689  Unit *clone() const override { return new Unit(*this); }
13690 
13691  /// \name Getters
13692  /// \{
13693 
13694  /**
13695  * \brief Return type (ast::AstNodeType) of ast node
13696  *
13697  * Every node in the ast has a type defined in ast::AstNodeType and this
13698  * function is used to retrieve the same.
13699  *
13700  * \return ast node type i.e. ast::AstNodeType::UNIT
13701  *
13702  * \sa Ast::get_node_type_name
13703  */
13704  AstNodeType get_node_type() const noexcept override {
13705  return AstNodeType::UNIT;
13706  }
13707 
13708  /**
13709  * \brief Return type (ast::AstNodeType) of ast node as std::string
13710  *
13711  * Every node in the ast has a type defined in ast::AstNodeType.
13712  * This type name can be returned as a std::string for printing
13713  * node to text/json form.
13714  *
13715  * \return name of the node type as a string i.e. "Unit"
13716  *
13717  * \sa Ast::get_node_name
13718  */
13719  std::string get_node_type_name() const noexcept override { return "Unit"; }
13720 
13721  /**
13722  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13723  */
13724  std::shared_ptr<Ast> get_shared_ptr() override {
13725  return std::static_pointer_cast<Unit>(shared_from_this());
13726  }
13727 
13728  /**
13729  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13730  */
13731  std::shared_ptr<const Ast> get_shared_ptr() const override {
13732  return std::static_pointer_cast<const Unit>(shared_from_this());
13733  }
13734 
13735  /**
13736  * \brief Return associated token for the current ast node
13737  *
13738  * Not all ast nodes have token information. For example,
13739  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
13740  * solution of ODEs. In this case, we return nullptr to store in the
13741  * nmodl::symtab::SymbolTable.
13742  *
13743  * \return pointer to token if exist otherwise nullptr
13744  */
13745  const ModToken *get_token() const noexcept override { return token.get(); }
13746 
13747  /**
13748  * \brief Return name of the node
13749  *
13750  * Some ast nodes have a member marked designated as node name. For example,
13751  * in case of this ast::String has name designated as a
13752  * node name.
13753  *
13754  * @return name of the node as std::string
13755  *
13756  * \sa Ast::get_node_type_name
13757  */
13758  std::string get_node_name() const override;
13759 
13760  /**
13761  * \brief Getter for member variable \ref Unit.name
13762  */
13763  const std::shared_ptr<String> &get_name() const noexcept { return name; }
13764 
13765  /// \}
13766 
13767  /// \name Setters
13768  /// \{
13769 
13770  /**
13771  * \brief Set token for the current ast node
13772  */
13773  void set_token(const ModToken &tok) {
13774  token = std::make_shared<ModToken>(tok);
13775  }
13776 
13777  /**
13778  * \brief Setter for member variable \ref Unit.name (rvalue reference)
13779  */
13780  void set_name(std::shared_ptr<String> &&name);
13781 
13782  /**
13783  * \brief Setter for member variable \ref Unit.name
13784  */
13785  void set_name(const std::shared_ptr<String> &name);
13786 
13787  /// \}
13788 
13789  /// \name Visitor
13790  /// \{
13791 
13792  /**
13793  * \brief visit children i.e. member variables of current node using provided
13794  * visitor
13795  *
13796  * Different nodes in the AST have different members (i.e. children). This
13797  * method recursively visits children using provided visitor.
13798  *
13799  * \param v Concrete visitor that will be used to recursively visit children
13800  *
13801  * \sa Ast::visit_children for example.
13802  */
13803  void visit_children(visitor::Visitor &v) override;
13804 
13805  /**
13806  * \brief accept (or visit) the current AST node using provided visitor
13807  *
13808  * Instead of visiting children of AST node, like Ast::visit_children,
13809  * accept allows to visit the current node itself using provided concrete
13810  * visitor.
13811  *
13812  * \param v Concrete visitor that will be used to recursively visit node
13813  *
13814  * \sa Ast::accept for example.
13815  */
13816  void accept(visitor::Visitor &v) override;
13817 
13818  /// \}
13819 
13820 private:
13821  /**
13822  * \brief Set this object as parent for all the children
13823  *
13824  * This should be called in every object (with children) constructor
13825  * to set parents. Since it is called only in the constructors it
13826  * should not be virtual to avoid ambiguities (issue #295).
13827  */
13828  void set_parent_in_children();
13829 };
13830 
13831 /** @} */ // end of ast_class
13832 
13833 } // namespace ast
13834 } // namespace nmodl
13835 #endif // !NMODL_AST_UNIT_HPP
13836 #ifndef NMODL_AST_DOUBLE_UNIT_HPP
13837 #define NMODL_AST_DOUBLE_UNIT_HPP
13838 
13839 namespace nmodl {
13840 namespace ast {
13841 
13842 /**
13843  * @addtogroup ast_class
13844  * @ingroup ast
13845  * @{
13846  */
13847 
13848 /**
13849  * \brief TODO
13850  *
13851  *
13852  */
13853 class DoubleUnit : public Expression {
13854 private:
13855  /// TODO
13856  std::shared_ptr<Double> value;
13857  /// TODO
13858  std::shared_ptr<Unit> unit;
13859  /// token with location information
13860  std::shared_ptr<ModToken> token;
13861 
13862 public:
13863  /// \name Ctor & dtor
13864  /// \{
13865 
13866  explicit DoubleUnit(Double *value, Unit *unit);
13867  explicit DoubleUnit(const std::shared_ptr<Double> &value,
13868  const std::shared_ptr<Unit> &unit);
13869  DoubleUnit(const DoubleUnit &obj);
13870 
13871  virtual ~DoubleUnit() = default;
13872 
13873  /// \}
13874 
13875  /**
13876  * \brief Check if the ast node is an instance of ast::DoubleUnit
13877  * \return true as object is of type ast::DoubleUnit
13878  */
13879  bool is_double_unit() const noexcept override { return true; }
13880 
13881  /**
13882  * \brief Return a copy of the current node
13883  *
13884  * Recursively make a new copy/clone of the current node including
13885  * all members and return a pointer to the node. This is used for
13886  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13887  * ast.
13888  *
13889  * @return pointer to the clone/copy of the current node
13890  */
13891  DoubleUnit *clone() const override { return new DoubleUnit(*this); }
13892 
13893  /// \name Getters
13894  /// \{
13895 
13896  /**
13897  * \brief Return type (ast::AstNodeType) of ast node
13898  *
13899  * Every node in the ast has a type defined in ast::AstNodeType and this
13900  * function is used to retrieve the same.
13901  *
13902  * \return ast node type i.e. ast::AstNodeType::DOUBLE_UNIT
13903  *
13904  * \sa Ast::get_node_type_name
13905  */
13906  AstNodeType get_node_type() const noexcept override {
13907  return AstNodeType::DOUBLE_UNIT;
13908  }
13909 
13910  /**
13911  * \brief Return type (ast::AstNodeType) of ast node as std::string
13912  *
13913  * Every node in the ast has a type defined in ast::AstNodeType.
13914  * This type name can be returned as a std::string for printing
13915  * node to text/json form.
13916  *
13917  * \return name of the node type as a string i.e. "DoubleUnit"
13918  *
13919  * \sa Ast::get_node_name
13920  */
13921  std::string get_node_type_name() const noexcept override {
13922  return "DoubleUnit";
13923  }
13924 
13925  /**
13926  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13927  */
13928  std::shared_ptr<Ast> get_shared_ptr() override {
13929  return std::static_pointer_cast<DoubleUnit>(shared_from_this());
13930  }
13931 
13932  /**
13933  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13934  */
13935  std::shared_ptr<const Ast> get_shared_ptr() const override {
13936  return std::static_pointer_cast<const DoubleUnit>(shared_from_this());
13937  }
13938 
13939  /**
13940  * \brief Return associated token for the current ast node
13941  *
13942  * Not all ast nodes have token information. For example,
13943  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
13944  * solution of ODEs. In this case, we return nullptr to store in the
13945  * nmodl::symtab::SymbolTable.
13946  *
13947  * \return pointer to token if exist otherwise nullptr
13948  */
13949  const ModToken *get_token() const noexcept override { return token.get(); }
13950 
13951  /**
13952  * \brief Getter for member variable \ref DoubleUnit.value
13953  */
13954  const std::shared_ptr<Double> &get_value() const noexcept { return value; }
13955 
13956  /**
13957  * \brief Getter for member variable \ref DoubleUnit.unit
13958  */
13959  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
13960 
13961  /// \}
13962 
13963  /// \name Setters
13964  /// \{
13965 
13966  /**
13967  * \brief Set token for the current ast node
13968  */
13969  void set_token(const ModToken &tok) {
13970  token = std::make_shared<ModToken>(tok);
13971  }
13972 
13973  /**
13974  * \brief Setter for member variable \ref DoubleUnit.value (rvalue reference)
13975  */
13976  void set_value(std::shared_ptr<Double> &&value);
13977 
13978  /**
13979  * \brief Setter for member variable \ref DoubleUnit.value
13980  */
13981  void set_value(const std::shared_ptr<Double> &value);
13982 
13983  /**
13984  * \brief Setter for member variable \ref DoubleUnit.unit (rvalue reference)
13985  */
13986  void set_unit(std::shared_ptr<Unit> &&unit);
13987 
13988  /**
13989  * \brief Setter for member variable \ref DoubleUnit.unit
13990  */
13991  void set_unit(const std::shared_ptr<Unit> &unit);
13992 
13993  /// \}
13994 
13995  /// \name Visitor
13996  /// \{
13997 
13998  /**
13999  * \brief visit children i.e. member variables of current node using provided
14000  * visitor
14001  *
14002  * Different nodes in the AST have different members (i.e. children). This
14003  * method recursively visits children using provided visitor.
14004  *
14005  * \param v Concrete visitor that will be used to recursively visit children
14006  *
14007  * \sa Ast::visit_children for example.
14008  */
14009  void visit_children(visitor::Visitor &v) override;
14010 
14011  /**
14012  * \brief accept (or visit) the current AST node using provided visitor
14013  *
14014  * Instead of visiting children of AST node, like Ast::visit_children,
14015  * accept allows to visit the current node itself using provided concrete
14016  * visitor.
14017  *
14018  * \param v Concrete visitor that will be used to recursively visit node
14019  *
14020  * \sa Ast::accept for example.
14021  */
14022  void accept(visitor::Visitor &v) override;
14023 
14024  /// \}
14025 
14026 private:
14027  /**
14028  * \brief Set this object as parent for all the children
14029  *
14030  * This should be called in every object (with children) constructor
14031  * to set parents. Since it is called only in the constructors it
14032  * should not be virtual to avoid ambiguities (issue #295).
14033  */
14034  void set_parent_in_children();
14035 };
14036 
14037 /** @} */ // end of ast_class
14038 
14039 } // namespace ast
14040 } // namespace nmodl
14041 #endif // !NMODL_AST_DOUBLE_UNIT_HPP
14042 #ifndef NMODL_AST_LOCAL_VAR_HPP
14043 #define NMODL_AST_LOCAL_VAR_HPP
14044 
14045 namespace nmodl {
14046 namespace ast {
14047 
14048 /**
14049  * @addtogroup ast_class
14050  * @ingroup ast
14051  * @{
14052  */
14053 
14054 /**
14055  * \brief TODO
14056  *
14057  *
14058  */
14059 class LocalVar : public Expression {
14060 private:
14061  /// TODO
14062  std::shared_ptr<Identifier> name;
14063  /// token with location information
14064  std::shared_ptr<ModToken> token;
14065 
14066 public:
14067  /// \name Ctor & dtor
14068  /// \{
14069 
14070  explicit LocalVar(Identifier *name);
14071  explicit LocalVar(const std::shared_ptr<Identifier> &name);
14072  LocalVar(const LocalVar &obj);
14073 
14074  virtual ~LocalVar() = default;
14075 
14076  /// \}
14077 
14078  /**
14079  * \brief Check if the ast node is an instance of ast::LocalVar
14080  * \return true as object is of type ast::LocalVar
14081  */
14082  bool is_local_var() const noexcept override { return true; }
14083 
14084  /**
14085  * \brief Return a copy of the current node
14086  *
14087  * Recursively make a new copy/clone of the current node including
14088  * all members and return a pointer to the node. This is used for
14089  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14090  * ast.
14091  *
14092  * @return pointer to the clone/copy of the current node
14093  */
14094  LocalVar *clone() const override { return new LocalVar(*this); }
14095 
14096  /// \name Getters
14097  /// \{
14098 
14099  /**
14100  * \brief Return type (ast::AstNodeType) of ast node
14101  *
14102  * Every node in the ast has a type defined in ast::AstNodeType and this
14103  * function is used to retrieve the same.
14104  *
14105  * \return ast node type i.e. ast::AstNodeType::LOCAL_VAR
14106  *
14107  * \sa Ast::get_node_type_name
14108  */
14109  AstNodeType get_node_type() const noexcept override {
14110  return AstNodeType::LOCAL_VAR;
14111  }
14112 
14113  /**
14114  * \brief Return type (ast::AstNodeType) of ast node as std::string
14115  *
14116  * Every node in the ast has a type defined in ast::AstNodeType.
14117  * This type name can be returned as a std::string for printing
14118  * node to text/json form.
14119  *
14120  * \return name of the node type as a string i.e. "LocalVar"
14121  *
14122  * \sa Ast::get_node_name
14123  */
14124  std::string get_node_type_name() const noexcept override {
14125  return "LocalVar";
14126  }
14127 
14128  /**
14129  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14130  */
14131  std::shared_ptr<Ast> get_shared_ptr() override {
14132  return std::static_pointer_cast<LocalVar>(shared_from_this());
14133  }
14134 
14135  /**
14136  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14137  */
14138  std::shared_ptr<const Ast> get_shared_ptr() const override {
14139  return std::static_pointer_cast<const LocalVar>(shared_from_this());
14140  }
14141 
14142  /**
14143  * \brief Return associated token for the current ast node
14144  *
14145  * Not all ast nodes have token information. For example,
14146  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
14147  * solution of ODEs. In this case, we return nullptr to store in the
14148  * nmodl::symtab::SymbolTable.
14149  *
14150  * \return pointer to token if exist otherwise nullptr
14151  */
14152  const ModToken *get_token() const noexcept override { return token.get(); }
14153 
14154  /**
14155  * \brief Return name of the node
14156  *
14157  * Some ast nodes have a member marked designated as node name. For example,
14158  * in case of this ast::Identifier has name designated as a
14159  * node name.
14160  *
14161  * @return name of the node as std::string
14162  *
14163  * \sa Ast::get_node_type_name
14164  */
14165  std::string get_node_name() const override;
14166 
14167  /**
14168  * \brief Getter for member variable \ref LocalVar.name
14169  */
14170  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
14171 
14172  /// \}
14173 
14174  /// \name Setters
14175  /// \{
14176 
14177  /**
14178  * \brief Set token for the current ast node
14179  */
14180  void set_token(const ModToken &tok) {
14181  token = std::make_shared<ModToken>(tok);
14182  }
14183 
14184  /**
14185  * \brief Setter for member variable \ref LocalVar.name (rvalue reference)
14186  */
14187  void set_name(std::shared_ptr<Identifier> &&name);
14188 
14189  /**
14190  * \brief Setter for member variable \ref LocalVar.name
14191  */
14192  void set_name(const std::shared_ptr<Identifier> &name);
14193 
14194  /// \}
14195 
14196  /// \name Visitor
14197  /// \{
14198 
14199  /**
14200  * \brief visit children i.e. member variables of current node using provided
14201  * visitor
14202  *
14203  * Different nodes in the AST have different members (i.e. children). This
14204  * method recursively visits children using provided visitor.
14205  *
14206  * \param v Concrete visitor that will be used to recursively visit children
14207  *
14208  * \sa Ast::visit_children for example.
14209  */
14210  void visit_children(visitor::Visitor &v) override;
14211 
14212  /**
14213  * \brief accept (or visit) the current AST node using provided visitor
14214  *
14215  * Instead of visiting children of AST node, like Ast::visit_children,
14216  * accept allows to visit the current node itself using provided concrete
14217  * visitor.
14218  *
14219  * \param v Concrete visitor that will be used to recursively visit node
14220  *
14221  * \sa Ast::accept for example.
14222  */
14223  void accept(visitor::Visitor &v) override;
14224 
14225  /// \}
14226 
14227 private:
14228  /**
14229  * \brief Set this object as parent for all the children
14230  *
14231  * This should be called in every object (with children) constructor
14232  * to set parents. Since it is called only in the constructors it
14233  * should not be virtual to avoid ambiguities (issue #295).
14234  */
14235  void set_parent_in_children();
14236 };
14237 
14238 /** @} */ // end of ast_class
14239 
14240 } // namespace ast
14241 } // namespace nmodl
14242 #endif // !NMODL_AST_LOCAL_VAR_HPP
14243 #ifndef NMODL_AST_LIMITS_HPP
14244 #define NMODL_AST_LIMITS_HPP
14245 
14246 namespace nmodl {
14247 namespace ast {
14248 
14249 /**
14250  * @addtogroup ast_class
14251  * @ingroup ast
14252  * @{
14253  */
14254 
14255 /**
14256  * \brief TODO
14257  *
14258  *
14259  */
14260 class Limits : public Expression {
14261 private:
14262  /// TODO
14263  std::shared_ptr<Double> min;
14264  /// TODO
14265  std::shared_ptr<Double> max;
14266  /// token with location information
14267  std::shared_ptr<ModToken> token;
14268 
14269 public:
14270  /// \name Ctor & dtor
14271  /// \{
14272 
14273  explicit Limits(Double *min, Double *max);
14274  explicit Limits(const std::shared_ptr<Double> &min,
14275  const std::shared_ptr<Double> &max);
14276  Limits(const Limits &obj);
14277 
14278  virtual ~Limits() = default;
14279 
14280  /// \}
14281 
14282  /**
14283  * \brief Check if the ast node is an instance of ast::Limits
14284  * \return true as object is of type ast::Limits
14285  */
14286  bool is_limits() const noexcept override { return true; }
14287 
14288  /**
14289  * \brief Return a copy of the current node
14290  *
14291  * Recursively make a new copy/clone of the current node including
14292  * all members and return a pointer to the node. This is used for
14293  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14294  * ast.
14295  *
14296  * @return pointer to the clone/copy of the current node
14297  */
14298  Limits *clone() const override { return new Limits(*this); }
14299 
14300  /// \name Getters
14301  /// \{
14302 
14303  /**
14304  * \brief Return type (ast::AstNodeType) of ast node
14305  *
14306  * Every node in the ast has a type defined in ast::AstNodeType and this
14307  * function is used to retrieve the same.
14308  *
14309  * \return ast node type i.e. ast::AstNodeType::LIMITS
14310  *
14311  * \sa Ast::get_node_type_name
14312  */
14313  AstNodeType get_node_type() const noexcept override {
14314  return AstNodeType::LIMITS;
14315  }
14316 
14317  /**
14318  * \brief Return type (ast::AstNodeType) of ast node as std::string
14319  *
14320  * Every node in the ast has a type defined in ast::AstNodeType.
14321  * This type name can be returned as a std::string for printing
14322  * node to text/json form.
14323  *
14324  * \return name of the node type as a string i.e. "Limits"
14325  *
14326  * \sa Ast::get_node_name
14327  */
14328  std::string get_node_type_name() const noexcept override { return "Limits"; }
14329 
14330  /**
14331  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14332  */
14333  std::shared_ptr<Ast> get_shared_ptr() override {
14334  return std::static_pointer_cast<Limits>(shared_from_this());
14335  }
14336 
14337  /**
14338  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14339  */
14340  std::shared_ptr<const Ast> get_shared_ptr() const override {
14341  return std::static_pointer_cast<const Limits>(shared_from_this());
14342  }
14343 
14344  /**
14345  * \brief Return associated token for the current ast node
14346  *
14347  * Not all ast nodes have token information. For example,
14348  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
14349  * solution of ODEs. In this case, we return nullptr to store in the
14350  * nmodl::symtab::SymbolTable.
14351  *
14352  * \return pointer to token if exist otherwise nullptr
14353  */
14354  const ModToken *get_token() const noexcept override { return token.get(); }
14355 
14356  /**
14357  * \brief Getter for member variable \ref Limits.min
14358  */
14359  const std::shared_ptr<Double> &get_min() const noexcept { return min; }
14360 
14361  /**
14362  * \brief Getter for member variable \ref Limits.max
14363  */
14364  const std::shared_ptr<Double> &get_max() const noexcept { return max; }
14365 
14366  /// \}
14367 
14368  /// \name Setters
14369  /// \{
14370 
14371  /**
14372  * \brief Set token for the current ast node
14373  */
14374  void set_token(const ModToken &tok) {
14375  token = std::make_shared<ModToken>(tok);
14376  }
14377 
14378  /**
14379  * \brief Setter for member variable \ref Limits.min (rvalue reference)
14380  */
14381  void set_min(std::shared_ptr<Double> &&min);
14382 
14383  /**
14384  * \brief Setter for member variable \ref Limits.min
14385  */
14386  void set_min(const std::shared_ptr<Double> &min);
14387 
14388  /**
14389  * \brief Setter for member variable \ref Limits.max (rvalue reference)
14390  */
14391  void set_max(std::shared_ptr<Double> &&max);
14392 
14393  /**
14394  * \brief Setter for member variable \ref Limits.max
14395  */
14396  void set_max(const std::shared_ptr<Double> &max);
14397 
14398  /// \}
14399 
14400  /// \name Visitor
14401  /// \{
14402 
14403  /**
14404  * \brief visit children i.e. member variables of current node using provided
14405  * visitor
14406  *
14407  * Different nodes in the AST have different members (i.e. children). This
14408  * method recursively visits children using provided visitor.
14409  *
14410  * \param v Concrete visitor that will be used to recursively visit children
14411  *
14412  * \sa Ast::visit_children for example.
14413  */
14414  void visit_children(visitor::Visitor &v) override;
14415 
14416  /**
14417  * \brief accept (or visit) the current AST node using provided visitor
14418  *
14419  * Instead of visiting children of AST node, like Ast::visit_children,
14420  * accept allows to visit the current node itself using provided concrete
14421  * visitor.
14422  *
14423  * \param v Concrete visitor that will be used to recursively visit node
14424  *
14425  * \sa Ast::accept for example.
14426  */
14427  void accept(visitor::Visitor &v) override;
14428 
14429  /// \}
14430 
14431 private:
14432  /**
14433  * \brief Set this object as parent for all the children
14434  *
14435  * This should be called in every object (with children) constructor
14436  * to set parents. Since it is called only in the constructors it
14437  * should not be virtual to avoid ambiguities (issue #295).
14438  */
14439  void set_parent_in_children();
14440 };
14441 
14442 /** @} */ // end of ast_class
14443 
14444 } // namespace ast
14445 } // namespace nmodl
14446 #endif // !NMODL_AST_LIMITS_HPP
14447 #ifndef NMODL_AST_NUMBER_RANGE_HPP
14448 #define NMODL_AST_NUMBER_RANGE_HPP
14449 
14450 namespace nmodl {
14451 namespace ast {
14452 
14453 /**
14454  * @addtogroup ast_class
14455  * @ingroup ast
14456  * @{
14457  */
14458 
14459 /**
14460  * \brief TODO
14461  *
14462  *
14463  */
14464 class NumberRange : public Expression {
14465 private:
14466  /// TODO
14467  std::shared_ptr<Number> min;
14468  /// TODO
14469  std::shared_ptr<Number> max;
14470  /// token with location information
14471  std::shared_ptr<ModToken> token;
14472 
14473 public:
14474  /// \name Ctor & dtor
14475  /// \{
14476 
14477  explicit NumberRange(Number *min, Number *max);
14478  explicit NumberRange(const std::shared_ptr<Number> &min,
14479  const std::shared_ptr<Number> &max);
14480  NumberRange(const NumberRange &obj);
14481 
14482  virtual ~NumberRange() = default;
14483 
14484  /// \}
14485 
14486  /**
14487  * \brief Check if the ast node is an instance of ast::NumberRange
14488  * \return true as object is of type ast::NumberRange
14489  */
14490  bool is_number_range() const noexcept override { return true; }
14491 
14492  /**
14493  * \brief Return a copy of the current node
14494  *
14495  * Recursively make a new copy/clone of the current node including
14496  * all members and return a pointer to the node. This is used for
14497  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14498  * ast.
14499  *
14500  * @return pointer to the clone/copy of the current node
14501  */
14502  NumberRange *clone() const override { return new NumberRange(*this); }
14503 
14504  /// \name Getters
14505  /// \{
14506 
14507  /**
14508  * \brief Return type (ast::AstNodeType) of ast node
14509  *
14510  * Every node in the ast has a type defined in ast::AstNodeType and this
14511  * function is used to retrieve the same.
14512  *
14513  * \return ast node type i.e. ast::AstNodeType::NUMBER_RANGE
14514  *
14515  * \sa Ast::get_node_type_name
14516  */
14517  AstNodeType get_node_type() const noexcept override {
14519  }
14520 
14521  /**
14522  * \brief Return type (ast::AstNodeType) of ast node as std::string
14523  *
14524  * Every node in the ast has a type defined in ast::AstNodeType.
14525  * This type name can be returned as a std::string for printing
14526  * node to text/json form.
14527  *
14528  * \return name of the node type as a string i.e. "NumberRange"
14529  *
14530  * \sa Ast::get_node_name
14531  */
14532  std::string get_node_type_name() const noexcept override {
14533  return "NumberRange";
14534  }
14535 
14536  /**
14537  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14538  */
14539  std::shared_ptr<Ast> get_shared_ptr() override {
14540  return std::static_pointer_cast<NumberRange>(shared_from_this());
14541  }
14542 
14543  /**
14544  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14545  */
14546  std::shared_ptr<const Ast> get_shared_ptr() const override {
14547  return std::static_pointer_cast<const NumberRange>(shared_from_this());
14548  }
14549 
14550  /**
14551  * \brief Return associated token for the current ast node
14552  *
14553  * Not all ast nodes have token information. For example,
14554  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
14555  * solution of ODEs. In this case, we return nullptr to store in the
14556  * nmodl::symtab::SymbolTable.
14557  *
14558  * \return pointer to token if exist otherwise nullptr
14559  */
14560  const ModToken *get_token() const noexcept override { return token.get(); }
14561 
14562  /**
14563  * \brief Getter for member variable \ref NumberRange.min
14564  */
14565  const std::shared_ptr<Number> &get_min() const noexcept { return min; }
14566 
14567  /**
14568  * \brief Getter for member variable \ref NumberRange.max
14569  */
14570  const std::shared_ptr<Number> &get_max() const noexcept { return max; }
14571 
14572  /// \}
14573 
14574  /// \name Setters
14575  /// \{
14576 
14577  /**
14578  * \brief Set token for the current ast node
14579  */
14580  void set_token(const ModToken &tok) {
14581  token = std::make_shared<ModToken>(tok);
14582  }
14583 
14584  /**
14585  * \brief Setter for member variable \ref NumberRange.min (rvalue reference)
14586  */
14587  void set_min(std::shared_ptr<Number> &&min);
14588 
14589  /**
14590  * \brief Setter for member variable \ref NumberRange.min
14591  */
14592  void set_min(const std::shared_ptr<Number> &min);
14593 
14594  /**
14595  * \brief Setter for member variable \ref NumberRange.max (rvalue reference)
14596  */
14597  void set_max(std::shared_ptr<Number> &&max);
14598 
14599  /**
14600  * \brief Setter for member variable \ref NumberRange.max
14601  */
14602  void set_max(const std::shared_ptr<Number> &max);
14603 
14604  /// \}
14605 
14606  /// \name Visitor
14607  /// \{
14608 
14609  /**
14610  * \brief visit children i.e. member variables of current node using provided
14611  * visitor
14612  *
14613  * Different nodes in the AST have different members (i.e. children). This
14614  * method recursively visits children using provided visitor.
14615  *
14616  * \param v Concrete visitor that will be used to recursively visit children
14617  *
14618  * \sa Ast::visit_children for example.
14619  */
14620  void visit_children(visitor::Visitor &v) override;
14621 
14622  /**
14623  * \brief accept (or visit) the current AST node using provided visitor
14624  *
14625  * Instead of visiting children of AST node, like Ast::visit_children,
14626  * accept allows to visit the current node itself using provided concrete
14627  * visitor.
14628  *
14629  * \param v Concrete visitor that will be used to recursively visit node
14630  *
14631  * \sa Ast::accept for example.
14632  */
14633  void accept(visitor::Visitor &v) override;
14634 
14635  /// \}
14636 
14637 private:
14638  /**
14639  * \brief Set this object as parent for all the children
14640  *
14641  * This should be called in every object (with children) constructor
14642  * to set parents. Since it is called only in the constructors it
14643  * should not be virtual to avoid ambiguities (issue #295).
14644  */
14645  void set_parent_in_children();
14646 };
14647 
14648 /** @} */ // end of ast_class
14649 
14650 } // namespace ast
14651 } // namespace nmodl
14652 #endif // !NMODL_AST_NUMBER_RANGE_HPP
14653 #ifndef NMODL_AST_PLOT_VAR_HPP
14654 #define NMODL_AST_PLOT_VAR_HPP
14655 
14656 namespace nmodl {
14657 namespace ast {
14658 
14659 /**
14660  * @addtogroup ast_class
14661  * @ingroup ast
14662  * @{
14663  */
14664 
14665 /**
14666  * \brief TODO
14667  *
14668  *
14669  */
14670 class PlotVar : public Expression {
14671 private:
14672  /// TODO
14673  std::shared_ptr<Identifier> name;
14674  /// TODO
14675  std::shared_ptr<Integer> index;
14676  /// token with location information
14677  std::shared_ptr<ModToken> token;
14678 
14679 public:
14680  /// \name Ctor & dtor
14681  /// \{
14682 
14683  explicit PlotVar(Identifier *name, Integer *index);
14684  explicit PlotVar(const std::shared_ptr<Identifier> &name,
14685  const std::shared_ptr<Integer> &index);
14686  PlotVar(const PlotVar &obj);
14687 
14688  virtual ~PlotVar() = default;
14689 
14690  /// \}
14691 
14692  /**
14693  * \brief Check if the ast node is an instance of ast::PlotVar
14694  * \return true as object is of type ast::PlotVar
14695  */
14696  bool is_plot_var() const noexcept override { return true; }
14697 
14698  /**
14699  * \brief Return a copy of the current node
14700  *
14701  * Recursively make a new copy/clone of the current node including
14702  * all members and return a pointer to the node. This is used for
14703  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14704  * ast.
14705  *
14706  * @return pointer to the clone/copy of the current node
14707  */
14708  PlotVar *clone() const override { return new PlotVar(*this); }
14709 
14710  /// \name Getters
14711  /// \{
14712 
14713  /**
14714  * \brief Return type (ast::AstNodeType) of ast node
14715  *
14716  * Every node in the ast has a type defined in ast::AstNodeType and this
14717  * function is used to retrieve the same.
14718  *
14719  * \return ast node type i.e. ast::AstNodeType::PLOT_VAR
14720  *
14721  * \sa Ast::get_node_type_name
14722  */
14723  AstNodeType get_node_type() const noexcept override {
14724  return AstNodeType::PLOT_VAR;
14725  }
14726 
14727  /**
14728  * \brief Return type (ast::AstNodeType) of ast node as std::string
14729  *
14730  * Every node in the ast has a type defined in ast::AstNodeType.
14731  * This type name can be returned as a std::string for printing
14732  * node to text/json form.
14733  *
14734  * \return name of the node type as a string i.e. "PlotVar"
14735  *
14736  * \sa Ast::get_node_name
14737  */
14738  std::string get_node_type_name() const noexcept override { return "PlotVar"; }
14739 
14740  /**
14741  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14742  */
14743  std::shared_ptr<Ast> get_shared_ptr() override {
14744  return std::static_pointer_cast<PlotVar>(shared_from_this());
14745  }
14746 
14747  /**
14748  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14749  */
14750  std::shared_ptr<const Ast> get_shared_ptr() const override {
14751  return std::static_pointer_cast<const PlotVar>(shared_from_this());
14752  }
14753 
14754  /**
14755  * \brief Return associated token for the current ast node
14756  *
14757  * Not all ast nodes have token information. For example,
14758  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
14759  * solution of ODEs. In this case, we return nullptr to store in the
14760  * nmodl::symtab::SymbolTable.
14761  *
14762  * \return pointer to token if exist otherwise nullptr
14763  */
14764  const ModToken *get_token() const noexcept override { return token.get(); }
14765 
14766  /**
14767  * \brief Getter for member variable \ref PlotVar.name
14768  */
14769  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
14770 
14771  /**
14772  * \brief Getter for member variable \ref PlotVar.index
14773  */
14774  const std::shared_ptr<Integer> &get_index() const noexcept { return index; }
14775 
14776  /// \}
14777 
14778  /// \name Setters
14779  /// \{
14780 
14781  /**
14782  * \brief Set token for the current ast node
14783  */
14784  void set_token(const ModToken &tok) {
14785  token = std::make_shared<ModToken>(tok);
14786  }
14787 
14788  /**
14789  * \brief Setter for member variable \ref PlotVar.name (rvalue reference)
14790  */
14791  void set_name(std::shared_ptr<Identifier> &&name);
14792 
14793  /**
14794  * \brief Setter for member variable \ref PlotVar.name
14795  */
14796  void set_name(const std::shared_ptr<Identifier> &name);
14797 
14798  /**
14799  * \brief Setter for member variable \ref PlotVar.index (rvalue reference)
14800  */
14801  void set_index(std::shared_ptr<Integer> &&index);
14802 
14803  /**
14804  * \brief Setter for member variable \ref PlotVar.index
14805  */
14806  void set_index(const std::shared_ptr<Integer> &index);
14807 
14808  /// \}
14809 
14810  /// \name Visitor
14811  /// \{
14812 
14813  /**
14814  * \brief visit children i.e. member variables of current node using provided
14815  * visitor
14816  *
14817  * Different nodes in the AST have different members (i.e. children). This
14818  * method recursively visits children using provided visitor.
14819  *
14820  * \param v Concrete visitor that will be used to recursively visit children
14821  *
14822  * \sa Ast::visit_children for example.
14823  */
14824  void visit_children(visitor::Visitor &v) override;
14825 
14826  /**
14827  * \brief accept (or visit) the current AST node using provided visitor
14828  *
14829  * Instead of visiting children of AST node, like Ast::visit_children,
14830  * accept allows to visit the current node itself using provided concrete
14831  * visitor.
14832  *
14833  * \param v Concrete visitor that will be used to recursively visit node
14834  *
14835  * \sa Ast::accept for example.
14836  */
14837  void accept(visitor::Visitor &v) override;
14838 
14839  /// \}
14840 
14841 private:
14842  /**
14843  * \brief Set this object as parent for all the children
14844  *
14845  * This should be called in every object (with children) constructor
14846  * to set parents. Since it is called only in the constructors it
14847  * should not be virtual to avoid ambiguities (issue #295).
14848  */
14849  void set_parent_in_children();
14850 };
14851 
14852 /** @} */ // end of ast_class
14853 
14854 } // namespace ast
14855 } // namespace nmodl
14856 #endif // !NMODL_AST_PLOT_VAR_HPP
14857 #ifndef NMODL_AST_CONSTANT_VAR_HPP
14858 #define NMODL_AST_CONSTANT_VAR_HPP
14859 
14860 namespace nmodl {
14861 namespace ast {
14862 
14863 /**
14864  * @addtogroup ast_class
14865  * @ingroup ast
14866  * @{
14867  */
14868 
14869 /**
14870  * \brief Represents a variable in the ast::ConstantBlock
14871  *
14872  *
14873  */
14874 class ConstantVar : public Expression {
14875 private:
14876  /// Name of the variable
14877  std::shared_ptr<Name> name;
14878  /// Value of the constant
14879  std::shared_ptr<Number> value;
14880  /// Unit for the variable
14881  std::shared_ptr<Unit> unit;
14882  /// token with location information
14883  std::shared_ptr<ModToken> token;
14884 
14885 public:
14886  /// \name Ctor & dtor
14887  /// \{
14888 
14889  explicit ConstantVar(Name *name, Number *value, Unit *unit);
14890  explicit ConstantVar(const std::shared_ptr<Name> &name,
14891  const std::shared_ptr<Number> &value,
14892  const std::shared_ptr<Unit> &unit);
14893  ConstantVar(const ConstantVar &obj);
14894 
14895  virtual ~ConstantVar() = default;
14896 
14897  /// \}
14898 
14899  /**
14900  * \brief Check if the ast node is an instance of ast::ConstantVar
14901  * \return true as object is of type ast::ConstantVar
14902  */
14903  bool is_constant_var() const noexcept override { return true; }
14904 
14905  /**
14906  * \brief Return a copy of the current node
14907  *
14908  * Recursively make a new copy/clone of the current node including
14909  * all members and return a pointer to the node. This is used for
14910  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14911  * ast.
14912  *
14913  * @return pointer to the clone/copy of the current node
14914  */
14915  ConstantVar *clone() const override { return new ConstantVar(*this); }
14916 
14917  /// \name Getters
14918  /// \{
14919 
14920  /**
14921  * \brief Return type (ast::AstNodeType) of ast node
14922  *
14923  * Every node in the ast has a type defined in ast::AstNodeType and this
14924  * function is used to retrieve the same.
14925  *
14926  * \return ast node type i.e. ast::AstNodeType::CONSTANT_VAR
14927  *
14928  * \sa Ast::get_node_type_name
14929  */
14930  AstNodeType get_node_type() const noexcept override {
14932  }
14933 
14934  /**
14935  * \brief Return type (ast::AstNodeType) of ast node as std::string
14936  *
14937  * Every node in the ast has a type defined in ast::AstNodeType.
14938  * This type name can be returned as a std::string for printing
14939  * node to text/json form.
14940  *
14941  * \return name of the node type as a string i.e. "ConstantVar"
14942  *
14943  * \sa Ast::get_node_name
14944  */
14945  std::string get_node_type_name() const noexcept override {
14946  return "ConstantVar";
14947  }
14948 
14949  /**
14950  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14951  */
14952  std::shared_ptr<Ast> get_shared_ptr() override {
14953  return std::static_pointer_cast<ConstantVar>(shared_from_this());
14954  }
14955 
14956  /**
14957  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14958  */
14959  std::shared_ptr<const Ast> get_shared_ptr() const override {
14960  return std::static_pointer_cast<const ConstantVar>(shared_from_this());
14961  }
14962 
14963  /**
14964  * \brief Return associated token for the current ast node
14965  *
14966  * Not all ast nodes have token information. For example,
14967  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
14968  * solution of ODEs. In this case, we return nullptr to store in the
14969  * nmodl::symtab::SymbolTable.
14970  *
14971  * \return pointer to token if exist otherwise nullptr
14972  */
14973  const ModToken *get_token() const noexcept override { return token.get(); }
14974 
14975  /**
14976  * \brief Return name of the node
14977  *
14978  * Some ast nodes have a member marked designated as node name. For example,
14979  * in case of this ast::Name has name designated as a
14980  * node name.
14981  *
14982  * @return name of the node as std::string
14983  *
14984  * \sa Ast::get_node_type_name
14985  */
14986  std::string get_node_name() const override;
14987 
14988  /**
14989  * \brief Getter for member variable \ref ConstantVar.name
14990  */
14991  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
14992 
14993  /**
14994  * \brief Getter for member variable \ref ConstantVar.value
14995  */
14996  const std::shared_ptr<Number> &get_value() const noexcept { return value; }
14997 
14998  /**
14999  * \brief Getter for member variable \ref ConstantVar.unit
15000  */
15001  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
15002 
15003  /// \}
15004 
15005  /// \name Setters
15006  /// \{
15007 
15008  /**
15009  * \brief Set token for the current ast node
15010  */
15011  void set_token(const ModToken &tok) {
15012  token = std::make_shared<ModToken>(tok);
15013  }
15014 
15015  /**
15016  * \brief Setter for member variable \ref ConstantVar.name (rvalue reference)
15017  */
15018  void set_name(std::shared_ptr<Name> &&name);
15019 
15020  /**
15021  * \brief Setter for member variable \ref ConstantVar.name
15022  */
15023  void set_name(const std::shared_ptr<Name> &name);
15024 
15025  /**
15026  * \brief Setter for member variable \ref ConstantVar.value (rvalue reference)
15027  */
15028  void set_value(std::shared_ptr<Number> &&value);
15029 
15030  /**
15031  * \brief Setter for member variable \ref ConstantVar.value
15032  */
15033  void set_value(const std::shared_ptr<Number> &value);
15034 
15035  /**
15036  * \brief Setter for member variable \ref ConstantVar.unit (rvalue reference)
15037  */
15038  void set_unit(std::shared_ptr<Unit> &&unit);
15039 
15040  /**
15041  * \brief Setter for member variable \ref ConstantVar.unit
15042  */
15043  void set_unit(const std::shared_ptr<Unit> &unit);
15044 
15045  /// \}
15046 
15047  /// \name Visitor
15048  /// \{
15049 
15050  /**
15051  * \brief visit children i.e. member variables of current node using provided
15052  * visitor
15053  *
15054  * Different nodes in the AST have different members (i.e. children). This
15055  * method recursively visits children using provided visitor.
15056  *
15057  * \param v Concrete visitor that will be used to recursively visit children
15058  *
15059  * \sa Ast::visit_children for example.
15060  */
15061  void visit_children(visitor::Visitor &v) override;
15062 
15063  /**
15064  * \brief accept (or visit) the current AST node using provided visitor
15065  *
15066  * Instead of visiting children of AST node, like Ast::visit_children,
15067  * accept allows to visit the current node itself using provided concrete
15068  * visitor.
15069  *
15070  * \param v Concrete visitor that will be used to recursively visit node
15071  *
15072  * \sa Ast::accept for example.
15073  */
15074  void accept(visitor::Visitor &v) override;
15075 
15076  /// \}
15077 
15078 private:
15079  /**
15080  * \brief Set this object as parent for all the children
15081  *
15082  * This should be called in every object (with children) constructor
15083  * to set parents. Since it is called only in the constructors it
15084  * should not be virtual to avoid ambiguities (issue #295).
15085  */
15086  void set_parent_in_children();
15087 };
15088 
15089 /** @} */ // end of ast_class
15090 
15091 } // namespace ast
15092 } // namespace nmodl
15093 #endif // !NMODL_AST_CONSTANT_VAR_HPP
15094 #ifndef NMODL_AST_BINARY_OPERATOR_HPP
15095 #define NMODL_AST_BINARY_OPERATOR_HPP
15096 
15097 namespace nmodl {
15098 namespace ast {
15099 
15100 /**
15101  * @addtogroup ast_class
15102  * @ingroup ast
15103  * @{
15104  */
15105 
15106 /**
15107  * \brief Operator used in ast::BinaryExpression
15108  *
15109  *
15110  */
15111 class BinaryOperator : public Expression {
15112 private:
15113  /// Operator
15115  /// token with location information
15116  std::shared_ptr<ModToken> token;
15117 
15118 public:
15119  /// \name Ctor & dtor
15120  /// \{
15121 
15122  explicit BinaryOperator(BinaryOp value);
15123  BinaryOperator(const BinaryOperator &obj);
15124 
15125  BinaryOperator() = default;
15126 
15127  virtual ~BinaryOperator() = default;
15128 
15129  /// \}
15130 
15131  /**
15132  * \brief Check if the ast node is an instance of ast::BinaryOperator
15133  * \return true as object is of type ast::BinaryOperator
15134  */
15135  bool is_binary_operator() const noexcept override { return true; }
15136 
15137  /**
15138  * \brief Return a copy of the current node
15139  *
15140  * Recursively make a new copy/clone of the current node including
15141  * all members and return a pointer to the node. This is used for
15142  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15143  * ast.
15144  *
15145  * @return pointer to the clone/copy of the current node
15146  */
15147  BinaryOperator *clone() const override { return new BinaryOperator(*this); }
15148 
15149  /// \name Getters
15150  /// \{
15151 
15152  /**
15153  * \brief Return type (ast::AstNodeType) of ast node
15154  *
15155  * Every node in the ast has a type defined in ast::AstNodeType and this
15156  * function is used to retrieve the same.
15157  *
15158  * \return ast node type i.e. ast::AstNodeType::BINARY_OPERATOR
15159  *
15160  * \sa Ast::get_node_type_name
15161  */
15162  AstNodeType get_node_type() const noexcept override {
15164  }
15165 
15166  /**
15167  * \brief Return type (ast::AstNodeType) of ast node as std::string
15168  *
15169  * Every node in the ast has a type defined in ast::AstNodeType.
15170  * This type name can be returned as a std::string for printing
15171  * node to text/json form.
15172  *
15173  * \return name of the node type as a string i.e. "BinaryOperator"
15174  *
15175  * \sa Ast::get_node_name
15176  */
15177  std::string get_node_type_name() const noexcept override {
15178  return "BinaryOperator";
15179  }
15180 
15181  /**
15182  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15183  */
15184  std::shared_ptr<Ast> get_shared_ptr() override {
15185  return std::static_pointer_cast<BinaryOperator>(shared_from_this());
15186  }
15187 
15188  /**
15189  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15190  */
15191  std::shared_ptr<const Ast> get_shared_ptr() const override {
15192  return std::static_pointer_cast<const BinaryOperator>(shared_from_this());
15193  }
15194 
15195  /**
15196  * \brief Return associated token for the current ast node
15197  *
15198  * Not all ast nodes have token information. For example,
15199  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15200  * solution of ODEs. In this case, we return nullptr to store in the
15201  * nmodl::symtab::SymbolTable.
15202  *
15203  * \return pointer to token if exist otherwise nullptr
15204  */
15205  const ModToken *get_token() const noexcept override { return token.get(); }
15206 
15207  /**
15208  * \brief Getter for member variable \ref BinaryOperator.value
15209  */
15210  BinaryOp get_value() const noexcept { return value; }
15211 
15212  /// \}
15213 
15214  /// \name Setters
15215  /// \{
15216 
15217  /**
15218  * \brief Set token for the current ast node
15219  */
15220  void set_token(const ModToken &tok) {
15221  token = std::make_shared<ModToken>(tok);
15222  }
15223 
15224  /**
15225  * \brief Setter for member variable \ref BinaryOperator.value
15226  */
15227  void set_value(BinaryOp value);
15228 
15229  /// \}
15230 
15231  /// \name Visitor
15232  /// \{
15233 
15234  /**
15235  * \brief visit children i.e. member variables of current node using provided
15236  * visitor
15237  *
15238  * Different nodes in the AST have different members (i.e. children). This
15239  * method recursively visits children using provided visitor.
15240  *
15241  * \param v Concrete visitor that will be used to recursively visit children
15242  *
15243  * \sa Ast::visit_children for example.
15244  */
15245  void visit_children(visitor::Visitor &v) override;
15246 
15247  /**
15248  * \brief accept (or visit) the current AST node using provided visitor
15249  *
15250  * Instead of visiting children of AST node, like Ast::visit_children,
15251  * accept allows to visit the current node itself using provided concrete
15252  * visitor.
15253  *
15254  * \param v Concrete visitor that will be used to recursively visit node
15255  *
15256  * \sa Ast::accept for example.
15257  */
15258  void accept(visitor::Visitor &v) override;
15259 
15260  /// \}
15261 
15262  /**
15263  * \brief Return enum value in string form
15264  *
15265  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
15266  * string representation when they are converted from AST back to
15267  * NMODL. This method is used to return corresponding string representation.
15268  */
15269  std::string eval() const { return BinaryOpNames[value]; }
15270 
15271 private:
15272  /**
15273  * \brief Set this object as parent for all the children
15274  *
15275  * This should be called in every object (with children) constructor
15276  * to set parents. Since it is called only in the constructors it
15277  * should not be virtual to avoid ambiguities (issue #295).
15278  */
15279  void set_parent_in_children();
15280 };
15281 
15282 /** @} */ // end of ast_class
15283 
15284 } // namespace ast
15285 } // namespace nmodl
15286 #endif // !NMODL_AST_BINARY_OPERATOR_HPP
15287 #ifndef NMODL_AST_UNARY_OPERATOR_HPP
15288 #define NMODL_AST_UNARY_OPERATOR_HPP
15289 
15290 namespace nmodl {
15291 namespace ast {
15292 
15293 /**
15294  * @addtogroup ast_class
15295  * @ingroup ast
15296  * @{
15297  */
15298 
15299 /**
15300  * \brief TODO
15301  *
15302  *
15303  */
15304 class UnaryOperator : public Expression {
15305 private:
15306  /// TODO
15308  /// token with location information
15309  std::shared_ptr<ModToken> token;
15310 
15311 public:
15312  /// \name Ctor & dtor
15313  /// \{
15314 
15315  explicit UnaryOperator(UnaryOp value);
15316  UnaryOperator(const UnaryOperator &obj);
15317 
15318  UnaryOperator() = default;
15319 
15320  virtual ~UnaryOperator() = default;
15321 
15322  /// \}
15323 
15324  /**
15325  * \brief Check if the ast node is an instance of ast::UnaryOperator
15326  * \return true as object is of type ast::UnaryOperator
15327  */
15328  bool is_unary_operator() const noexcept override { return true; }
15329 
15330  /**
15331  * \brief Return a copy of the current node
15332  *
15333  * Recursively make a new copy/clone of the current node including
15334  * all members and return a pointer to the node. This is used for
15335  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15336  * ast.
15337  *
15338  * @return pointer to the clone/copy of the current node
15339  */
15340  UnaryOperator *clone() const override { return new UnaryOperator(*this); }
15341 
15342  /// \name Getters
15343  /// \{
15344 
15345  /**
15346  * \brief Return type (ast::AstNodeType) of ast node
15347  *
15348  * Every node in the ast has a type defined in ast::AstNodeType and this
15349  * function is used to retrieve the same.
15350  *
15351  * \return ast node type i.e. ast::AstNodeType::UNARY_OPERATOR
15352  *
15353  * \sa Ast::get_node_type_name
15354  */
15355  AstNodeType get_node_type() const noexcept override {
15357  }
15358 
15359  /**
15360  * \brief Return type (ast::AstNodeType) of ast node as std::string
15361  *
15362  * Every node in the ast has a type defined in ast::AstNodeType.
15363  * This type name can be returned as a std::string for printing
15364  * node to text/json form.
15365  *
15366  * \return name of the node type as a string i.e. "UnaryOperator"
15367  *
15368  * \sa Ast::get_node_name
15369  */
15370  std::string get_node_type_name() const noexcept override {
15371  return "UnaryOperator";
15372  }
15373 
15374  /**
15375  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15376  */
15377  std::shared_ptr<Ast> get_shared_ptr() override {
15378  return std::static_pointer_cast<UnaryOperator>(shared_from_this());
15379  }
15380 
15381  /**
15382  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15383  */
15384  std::shared_ptr<const Ast> get_shared_ptr() const override {
15385  return std::static_pointer_cast<const UnaryOperator>(shared_from_this());
15386  }
15387 
15388  /**
15389  * \brief Return associated token for the current ast node
15390  *
15391  * Not all ast nodes have token information. For example,
15392  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15393  * solution of ODEs. In this case, we return nullptr to store in the
15394  * nmodl::symtab::SymbolTable.
15395  *
15396  * \return pointer to token if exist otherwise nullptr
15397  */
15398  const ModToken *get_token() const noexcept override { return token.get(); }
15399 
15400  /**
15401  * \brief Getter for member variable \ref UnaryOperator.value
15402  */
15403  UnaryOp get_value() const noexcept { return value; }
15404 
15405  /// \}
15406 
15407  /// \name Setters
15408  /// \{
15409 
15410  /**
15411  * \brief Set token for the current ast node
15412  */
15413  void set_token(const ModToken &tok) {
15414  token = std::make_shared<ModToken>(tok);
15415  }
15416 
15417  /**
15418  * \brief Setter for member variable \ref UnaryOperator.value
15419  */
15420  void set_value(UnaryOp value);
15421 
15422  /// \}
15423 
15424  /// \name Visitor
15425  /// \{
15426 
15427  /**
15428  * \brief visit children i.e. member variables of current node using provided
15429  * visitor
15430  *
15431  * Different nodes in the AST have different members (i.e. children). This
15432  * method recursively visits children using provided visitor.
15433  *
15434  * \param v Concrete visitor that will be used to recursively visit children
15435  *
15436  * \sa Ast::visit_children for example.
15437  */
15438  void visit_children(visitor::Visitor &v) override;
15439 
15440  /**
15441  * \brief accept (or visit) the current AST node using provided visitor
15442  *
15443  * Instead of visiting children of AST node, like Ast::visit_children,
15444  * accept allows to visit the current node itself using provided concrete
15445  * visitor.
15446  *
15447  * \param v Concrete visitor that will be used to recursively visit node
15448  *
15449  * \sa Ast::accept for example.
15450  */
15451  void accept(visitor::Visitor &v) override;
15452 
15453  /// \}
15454 
15455  /**
15456  * \brief Return enum value in string form
15457  *
15458  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
15459  * string representation when they are converted from AST back to
15460  * NMODL. This method is used to return corresponding string representation.
15461  */
15462  std::string eval() const { return UnaryOpNames[value]; }
15463 
15464 private:
15465  /**
15466  * \brief Set this object as parent for all the children
15467  *
15468  * This should be called in every object (with children) constructor
15469  * to set parents. Since it is called only in the constructors it
15470  * should not be virtual to avoid ambiguities (issue #295).
15471  */
15472  void set_parent_in_children();
15473 };
15474 
15475 /** @} */ // end of ast_class
15476 
15477 } // namespace ast
15478 } // namespace nmodl
15479 #endif // !NMODL_AST_UNARY_OPERATOR_HPP
15480 #ifndef NMODL_AST_REACTION_OPERATOR_HPP
15481 #define NMODL_AST_REACTION_OPERATOR_HPP
15482 
15483 namespace nmodl {
15484 namespace ast {
15485 
15486 /**
15487  * @addtogroup ast_class
15488  * @ingroup ast
15489  * @{
15490  */
15491 
15492 /**
15493  * \brief TODO
15494  *
15495  *
15496  */
15498 private:
15499  /// TODO
15501  /// token with location information
15502  std::shared_ptr<ModToken> token;
15503 
15504 public:
15505  /// \name Ctor & dtor
15506  /// \{
15507 
15508  explicit ReactionOperator(ReactionOp value);
15509  ReactionOperator(const ReactionOperator &obj);
15510 
15511  ReactionOperator() = default;
15512 
15513  virtual ~ReactionOperator() = default;
15514 
15515  /// \}
15516 
15517  /**
15518  * \brief Check if the ast node is an instance of ast::ReactionOperator
15519  * \return true as object is of type ast::ReactionOperator
15520  */
15521  bool is_reaction_operator() const noexcept override { return true; }
15522 
15523  /**
15524  * \brief Return a copy of the current node
15525  *
15526  * Recursively make a new copy/clone of the current node including
15527  * all members and return a pointer to the node. This is used for
15528  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15529  * ast.
15530  *
15531  * @return pointer to the clone/copy of the current node
15532  */
15533  ReactionOperator *clone() const override {
15534  return new ReactionOperator(*this);
15535  }
15536 
15537  /// \name Getters
15538  /// \{
15539 
15540  /**
15541  * \brief Return type (ast::AstNodeType) of ast node
15542  *
15543  * Every node in the ast has a type defined in ast::AstNodeType and this
15544  * function is used to retrieve the same.
15545  *
15546  * \return ast node type i.e. ast::AstNodeType::REACTION_OPERATOR
15547  *
15548  * \sa Ast::get_node_type_name
15549  */
15550  AstNodeType get_node_type() const noexcept override {
15552  }
15553 
15554  /**
15555  * \brief Return type (ast::AstNodeType) of ast node as std::string
15556  *
15557  * Every node in the ast has a type defined in ast::AstNodeType.
15558  * This type name can be returned as a std::string for printing
15559  * node to text/json form.
15560  *
15561  * \return name of the node type as a string i.e. "ReactionOperator"
15562  *
15563  * \sa Ast::get_node_name
15564  */
15565  std::string get_node_type_name() const noexcept override {
15566  return "ReactionOperator";
15567  }
15568 
15569  /**
15570  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15571  */
15572  std::shared_ptr<Ast> get_shared_ptr() override {
15573  return std::static_pointer_cast<ReactionOperator>(shared_from_this());
15574  }
15575 
15576  /**
15577  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15578  */
15579  std::shared_ptr<const Ast> get_shared_ptr() const override {
15580  return std::static_pointer_cast<const ReactionOperator>(shared_from_this());
15581  }
15582 
15583  /**
15584  * \brief Return associated token for the current ast node
15585  *
15586  * Not all ast nodes have token information. For example,
15587  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15588  * solution of ODEs. In this case, we return nullptr to store in the
15589  * nmodl::symtab::SymbolTable.
15590  *
15591  * \return pointer to token if exist otherwise nullptr
15592  */
15593  const ModToken *get_token() const noexcept override { return token.get(); }
15594 
15595  /**
15596  * \brief Getter for member variable \ref ReactionOperator.value
15597  */
15598  ReactionOp get_value() const noexcept { return value; }
15599 
15600  /// \}
15601 
15602  /// \name Setters
15603  /// \{
15604 
15605  /**
15606  * \brief Set token for the current ast node
15607  */
15608  void set_token(const ModToken &tok) {
15609  token = std::make_shared<ModToken>(tok);
15610  }
15611 
15612  /**
15613  * \brief Setter for member variable \ref ReactionOperator.value
15614  */
15615  void set_value(ReactionOp value);
15616 
15617  /// \}
15618 
15619  /// \name Visitor
15620  /// \{
15621 
15622  /**
15623  * \brief visit children i.e. member variables of current node using provided
15624  * visitor
15625  *
15626  * Different nodes in the AST have different members (i.e. children). This
15627  * method recursively visits children using provided visitor.
15628  *
15629  * \param v Concrete visitor that will be used to recursively visit children
15630  *
15631  * \sa Ast::visit_children for example.
15632  */
15633  void visit_children(visitor::Visitor &v) override;
15634 
15635  /**
15636  * \brief accept (or visit) the current AST node using provided visitor
15637  *
15638  * Instead of visiting children of AST node, like Ast::visit_children,
15639  * accept allows to visit the current node itself using provided concrete
15640  * visitor.
15641  *
15642  * \param v Concrete visitor that will be used to recursively visit node
15643  *
15644  * \sa Ast::accept for example.
15645  */
15646  void accept(visitor::Visitor &v) override;
15647 
15648  /// \}
15649 
15650  /**
15651  * \brief Return enum value in string form
15652  *
15653  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
15654  * string representation when they are converted from AST back to
15655  * NMODL. This method is used to return corresponding string representation.
15656  */
15657  std::string eval() const { return ReactionOpNames[value]; }
15658 
15659 private:
15660  /**
15661  * \brief Set this object as parent for all the children
15662  *
15663  * This should be called in every object (with children) constructor
15664  * to set parents. Since it is called only in the constructors it
15665  * should not be virtual to avoid ambiguities (issue #295).
15666  */
15667  void set_parent_in_children();
15668 };
15669 
15670 /** @} */ // end of ast_class
15671 
15672 } // namespace ast
15673 } // namespace nmodl
15674 #endif // !NMODL_AST_REACTION_OPERATOR_HPP
15675 #ifndef NMODL_AST_PAREN_EXPRESSION_HPP
15676 #define NMODL_AST_PAREN_EXPRESSION_HPP
15677 
15678 namespace nmodl {
15679 namespace ast {
15680 
15681 /**
15682  * @addtogroup ast_class
15683  * @ingroup ast
15684  * @{
15685  */
15686 
15687 /**
15688  * \brief TODO
15689  *
15690  *
15691  */
15692 class ParenExpression : public Expression {
15693 private:
15694  /// TODO
15695  std::shared_ptr<Expression> expression;
15696  /// token with location information
15697  std::shared_ptr<ModToken> token;
15698 
15699 public:
15700  /// \name Ctor & dtor
15701  /// \{
15702 
15703  explicit ParenExpression(Expression *expression);
15704  explicit ParenExpression(const std::shared_ptr<Expression> &expression);
15705  ParenExpression(const ParenExpression &obj);
15706 
15707  virtual ~ParenExpression() = default;
15708 
15709  /// \}
15710 
15711  /**
15712  * \brief Check if the ast node is an instance of ast::ParenExpression
15713  * \return true as object is of type ast::ParenExpression
15714  */
15715  bool is_paren_expression() const noexcept override { return true; }
15716 
15717  /**
15718  * \brief Return a copy of the current node
15719  *
15720  * Recursively make a new copy/clone of the current node including
15721  * all members and return a pointer to the node. This is used for
15722  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15723  * ast.
15724  *
15725  * @return pointer to the clone/copy of the current node
15726  */
15727  ParenExpression *clone() const override { return new ParenExpression(*this); }
15728 
15729  /// \name Getters
15730  /// \{
15731 
15732  /**
15733  * \brief Return type (ast::AstNodeType) of ast node
15734  *
15735  * Every node in the ast has a type defined in ast::AstNodeType and this
15736  * function is used to retrieve the same.
15737  *
15738  * \return ast node type i.e. ast::AstNodeType::PAREN_EXPRESSION
15739  *
15740  * \sa Ast::get_node_type_name
15741  */
15742  AstNodeType get_node_type() const noexcept override {
15744  }
15745 
15746  /**
15747  * \brief Return type (ast::AstNodeType) of ast node as std::string
15748  *
15749  * Every node in the ast has a type defined in ast::AstNodeType.
15750  * This type name can be returned as a std::string for printing
15751  * node to text/json form.
15752  *
15753  * \return name of the node type as a string i.e. "ParenExpression"
15754  *
15755  * \sa Ast::get_node_name
15756  */
15757  std::string get_node_type_name() const noexcept override {
15758  return "ParenExpression";
15759  }
15760 
15761  /**
15762  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15763  */
15764  std::shared_ptr<Ast> get_shared_ptr() override {
15765  return std::static_pointer_cast<ParenExpression>(shared_from_this());
15766  }
15767 
15768  /**
15769  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15770  */
15771  std::shared_ptr<const Ast> get_shared_ptr() const override {
15772  return std::static_pointer_cast<const ParenExpression>(shared_from_this());
15773  }
15774 
15775  /**
15776  * \brief Return associated token for the current ast node
15777  *
15778  * Not all ast nodes have token information. For example,
15779  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15780  * solution of ODEs. In this case, we return nullptr to store in the
15781  * nmodl::symtab::SymbolTable.
15782  *
15783  * \return pointer to token if exist otherwise nullptr
15784  */
15785  const ModToken *get_token() const noexcept override { return token.get(); }
15786 
15787  /**
15788  * \brief Getter for member variable \ref ParenExpression.expression
15789  */
15790  const std::shared_ptr<Expression> &get_expression() const noexcept {
15791  return expression;
15792  }
15793 
15794  /// \}
15795 
15796  /// \name Setters
15797  /// \{
15798 
15799  /**
15800  * \brief Set token for the current ast node
15801  */
15802  void set_token(const ModToken &tok) {
15803  token = std::make_shared<ModToken>(tok);
15804  }
15805 
15806  /**
15807  * \brief Setter for member variable \ref ParenExpression.expression (rvalue
15808  * reference)
15809  */
15810  void set_expression(std::shared_ptr<Expression> &&expression);
15811 
15812  /**
15813  * \brief Setter for member variable \ref ParenExpression.expression
15814  */
15815  void set_expression(const std::shared_ptr<Expression> &expression);
15816 
15817  /// \}
15818 
15819  /// \name Visitor
15820  /// \{
15821 
15822  /**
15823  * \brief visit children i.e. member variables of current node using provided
15824  * visitor
15825  *
15826  * Different nodes in the AST have different members (i.e. children). This
15827  * method recursively visits children using provided visitor.
15828  *
15829  * \param v Concrete visitor that will be used to recursively visit children
15830  *
15831  * \sa Ast::visit_children for example.
15832  */
15833  void visit_children(visitor::Visitor &v) override;
15834 
15835  /**
15836  * \brief accept (or visit) the current AST node using provided visitor
15837  *
15838  * Instead of visiting children of AST node, like Ast::visit_children,
15839  * accept allows to visit the current node itself using provided concrete
15840  * visitor.
15841  *
15842  * \param v Concrete visitor that will be used to recursively visit node
15843  *
15844  * \sa Ast::accept for example.
15845  */
15846  void accept(visitor::Visitor &v) override;
15847 
15848  /// \}
15849 
15850 private:
15851  /**
15852  * \brief Set this object as parent for all the children
15853  *
15854  * This should be called in every object (with children) constructor
15855  * to set parents. Since it is called only in the constructors it
15856  * should not be virtual to avoid ambiguities (issue #295).
15857  */
15858  void set_parent_in_children();
15859 };
15860 
15861 /** @} */ // end of ast_class
15862 
15863 } // namespace ast
15864 } // namespace nmodl
15865 #endif // !NMODL_AST_PAREN_EXPRESSION_HPP
15866 #ifndef NMODL_AST_BINARY_EXPRESSION_HPP
15867 #define NMODL_AST_BINARY_EXPRESSION_HPP
15868 
15869 namespace nmodl {
15870 namespace ast {
15871 
15872 /**
15873  * @addtogroup ast_class
15874  * @ingroup ast
15875  * @{
15876  */
15877 
15878 /**
15879  * \brief Represents binary expression in the NMODL
15880  *
15881  * Any binary expression in the mod file is represented by this node type.
15882  * For example, in below example, there are three binary expressions :
15883  *
15884  * \code{.mod}
15885  * BREAKPOINT {
15886  * SOLVE states METHOD cnexp
15887  * ina = gna*(v - ena)
15888  * }
15889  * \endcode
15890  *
15891  * Note that the statement itself is stored in another type
15892  * ast::ExpressionStatement.
15893  *
15894  * \sa ast::ExpressionStatement
15895  *
15896  */
15898 private:
15899  /// LHS of the binary expression
15900  std::shared_ptr<Expression> lhs;
15901  /// Operator
15903  /// RHS of the binary expression
15904  std::shared_ptr<Expression> rhs;
15905  /// token with location information
15906  std::shared_ptr<ModToken> token;
15907 
15908 public:
15909  /// \name Ctor & dtor
15910  /// \{
15911 
15912  explicit BinaryExpression(Expression *lhs, const BinaryOperator &op,
15913  Expression *rhs);
15914  explicit BinaryExpression(const std::shared_ptr<Expression> &lhs,
15915  const BinaryOperator &op,
15916  const std::shared_ptr<Expression> &rhs);
15917  BinaryExpression(const BinaryExpression &obj);
15918 
15919  virtual ~BinaryExpression() = default;
15920 
15921  /// \}
15922 
15923  /**
15924  * \brief Check if the ast node is an instance of ast::BinaryExpression
15925  * \return true as object is of type ast::BinaryExpression
15926  */
15927  bool is_binary_expression() const noexcept override { return true; }
15928 
15929  /**
15930  * \brief Return a copy of the current node
15931  *
15932  * Recursively make a new copy/clone of the current node including
15933  * all members and return a pointer to the node. This is used for
15934  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15935  * ast.
15936  *
15937  * @return pointer to the clone/copy of the current node
15938  */
15939  BinaryExpression *clone() const override {
15940  return new BinaryExpression(*this);
15941  }
15942 
15943  /// \name Getters
15944  /// \{
15945 
15946  /**
15947  * \brief Return type (ast::AstNodeType) of ast node
15948  *
15949  * Every node in the ast has a type defined in ast::AstNodeType and this
15950  * function is used to retrieve the same.
15951  *
15952  * \return ast node type i.e. ast::AstNodeType::BINARY_EXPRESSION
15953  *
15954  * \sa Ast::get_node_type_name
15955  */
15956  AstNodeType get_node_type() const noexcept override {
15958  }
15959 
15960  /**
15961  * \brief Return type (ast::AstNodeType) of ast node as std::string
15962  *
15963  * Every node in the ast has a type defined in ast::AstNodeType.
15964  * This type name can be returned as a std::string for printing
15965  * node to text/json form.
15966  *
15967  * \return name of the node type as a string i.e. "BinaryExpression"
15968  *
15969  * \sa Ast::get_node_name
15970  */
15971  std::string get_node_type_name() const noexcept override {
15972  return "BinaryExpression";
15973  }
15974 
15975  /**
15976  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15977  */
15978  std::shared_ptr<Ast> get_shared_ptr() override {
15979  return std::static_pointer_cast<BinaryExpression>(shared_from_this());
15980  }
15981 
15982  /**
15983  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15984  */
15985  std::shared_ptr<const Ast> get_shared_ptr() const override {
15986  return std::static_pointer_cast<const BinaryExpression>(shared_from_this());
15987  }
15988 
15989  /**
15990  * \brief Return associated token for the current ast node
15991  *
15992  * Not all ast nodes have token information. For example,
15993  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15994  * solution of ODEs. In this case, we return nullptr to store in the
15995  * nmodl::symtab::SymbolTable.
15996  *
15997  * \return pointer to token if exist otherwise nullptr
15998  */
15999  const ModToken *get_token() const noexcept override { return token.get(); }
16000 
16001  /**
16002  * \brief Getter for member variable \ref BinaryExpression.lhs
16003  */
16004  const std::shared_ptr<Expression> &get_lhs() const noexcept { return lhs; }
16005 
16006  /**
16007  * \brief Getter for member variable \ref BinaryExpression.op
16008  */
16009  const BinaryOperator &get_op() const noexcept { return op; }
16010 
16011  /**
16012  * \brief Getter for member variable \ref BinaryExpression.rhs
16013  */
16014  const std::shared_ptr<Expression> &get_rhs() const noexcept { return rhs; }
16015 
16016  /// \}
16017 
16018  /// \name Setters
16019  /// \{
16020 
16021  /**
16022  * \brief Set token for the current ast node
16023  */
16024  void set_token(const ModToken &tok) {
16025  token = std::make_shared<ModToken>(tok);
16026  }
16027 
16028  /**
16029  * \brief Setter for member variable \ref BinaryExpression.lhs (rvalue
16030  * reference)
16031  */
16032  void set_lhs(std::shared_ptr<Expression> &&lhs);
16033 
16034  /**
16035  * \brief Setter for member variable \ref BinaryExpression.lhs
16036  */
16037  void set_lhs(const std::shared_ptr<Expression> &lhs);
16038 
16039  /**
16040  * \brief Setter for member variable \ref BinaryExpression.op (rvalue
16041  * reference)
16042  */
16043  void set_op(BinaryOperator &&op);
16044 
16045  /**
16046  * \brief Setter for member variable \ref BinaryExpression.op
16047  */
16048  void set_op(const BinaryOperator &op);
16049 
16050  /**
16051  * \brief Setter for member variable \ref BinaryExpression.rhs (rvalue
16052  * reference)
16053  */
16054  void set_rhs(std::shared_ptr<Expression> &&rhs);
16055 
16056  /**
16057  * \brief Setter for member variable \ref BinaryExpression.rhs
16058  */
16059  void set_rhs(const std::shared_ptr<Expression> &rhs);
16060 
16061  /// \}
16062 
16063  /// \name Visitor
16064  /// \{
16065 
16066  /**
16067  * \brief visit children i.e. member variables of current node using provided
16068  * visitor
16069  *
16070  * Different nodes in the AST have different members (i.e. children). This
16071  * method recursively visits children using provided visitor.
16072  *
16073  * \param v Concrete visitor that will be used to recursively visit children
16074  *
16075  * \sa Ast::visit_children for example.
16076  */
16077  void visit_children(visitor::Visitor &v) override;
16078 
16079  /**
16080  * \brief accept (or visit) the current AST node using provided visitor
16081  *
16082  * Instead of visiting children of AST node, like Ast::visit_children,
16083  * accept allows to visit the current node itself using provided concrete
16084  * visitor.
16085  *
16086  * \param v Concrete visitor that will be used to recursively visit node
16087  *
16088  * \sa Ast::accept for example.
16089  */
16090  void accept(visitor::Visitor &v) override;
16091 
16092  /// \}
16093 
16094 private:
16095  /**
16096  * \brief Set this object as parent for all the children
16097  *
16098  * This should be called in every object (with children) constructor
16099  * to set parents. Since it is called only in the constructors it
16100  * should not be virtual to avoid ambiguities (issue #295).
16101  */
16102  void set_parent_in_children();
16103 };
16104 
16105 /** @} */ // end of ast_class
16106 
16107 } // namespace ast
16108 } // namespace nmodl
16109 #endif // !NMODL_AST_BINARY_EXPRESSION_HPP
16110 #ifndef NMODL_AST_DIFF_EQ_EXPRESSION_HPP
16111 #define NMODL_AST_DIFF_EQ_EXPRESSION_HPP
16112 
16113 namespace nmodl {
16114 namespace ast {
16115 
16116 /**
16117  * @addtogroup ast_class
16118  * @ingroup ast
16119  * @{
16120  */
16121 
16122 /**
16123  * \brief Represents differential equation in DERIVATIVE block
16124  *
16125  *
16126  */
16128 private:
16129  /// Differential Expression
16130  std::shared_ptr<BinaryExpression> expression;
16131  /// token with location information
16132  std::shared_ptr<ModToken> token;
16133 
16134 public:
16135  /// \name Ctor & dtor
16136  /// \{
16137 
16138  explicit DiffEqExpression(BinaryExpression *expression);
16139  explicit DiffEqExpression(
16140  const std::shared_ptr<BinaryExpression> &expression);
16141  DiffEqExpression(const DiffEqExpression &obj);
16142 
16143  virtual ~DiffEqExpression() = default;
16144 
16145  /// \}
16146 
16147  /**
16148  * \brief Check if the ast node is an instance of ast::DiffEqExpression
16149  * \return true as object is of type ast::DiffEqExpression
16150  */
16151  bool is_diff_eq_expression() const noexcept override { return true; }
16152 
16153  /**
16154  * \brief Return a copy of the current node
16155  *
16156  * Recursively make a new copy/clone of the current node including
16157  * all members and return a pointer to the node. This is used for
16158  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16159  * ast.
16160  *
16161  * @return pointer to the clone/copy of the current node
16162  */
16163  DiffEqExpression *clone() const override {
16164  return new DiffEqExpression(*this);
16165  }
16166 
16167  /// \name Getters
16168  /// \{
16169 
16170  /**
16171  * \brief Return type (ast::AstNodeType) of ast node
16172  *
16173  * Every node in the ast has a type defined in ast::AstNodeType and this
16174  * function is used to retrieve the same.
16175  *
16176  * \return ast node type i.e. ast::AstNodeType::DIFF_EQ_EXPRESSION
16177  *
16178  * \sa Ast::get_node_type_name
16179  */
16180  AstNodeType get_node_type() const noexcept override {
16182  }
16183 
16184  /**
16185  * \brief Return type (ast::AstNodeType) of ast node as std::string
16186  *
16187  * Every node in the ast has a type defined in ast::AstNodeType.
16188  * This type name can be returned as a std::string for printing
16189  * node to text/json form.
16190  *
16191  * \return name of the node type as a string i.e. "DiffEqExpression"
16192  *
16193  * \sa Ast::get_node_name
16194  */
16195  std::string get_node_type_name() const noexcept override {
16196  return "DiffEqExpression";
16197  }
16198 
16199  /**
16200  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16201  */
16202  std::shared_ptr<Ast> get_shared_ptr() override {
16203  return std::static_pointer_cast<DiffEqExpression>(shared_from_this());
16204  }
16205 
16206  /**
16207  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16208  */
16209  std::shared_ptr<const Ast> get_shared_ptr() const override {
16210  return std::static_pointer_cast<const DiffEqExpression>(shared_from_this());
16211  }
16212 
16213  /**
16214  * \brief Return associated token for the current ast node
16215  *
16216  * Not all ast nodes have token information. For example,
16217  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
16218  * solution of ODEs. In this case, we return nullptr to store in the
16219  * nmodl::symtab::SymbolTable.
16220  *
16221  * \return pointer to token if exist otherwise nullptr
16222  */
16223  const ModToken *get_token() const noexcept override { return token.get(); }
16224 
16225  /**
16226  * \brief Getter for member variable \ref DiffEqExpression.expression
16227  */
16228  const std::shared_ptr<BinaryExpression> &get_expression() const noexcept {
16229  return expression;
16230  }
16231 
16232  /// \}
16233 
16234  /// \name Setters
16235  /// \{
16236 
16237  /**
16238  * \brief Set token for the current ast node
16239  */
16240  void set_token(const ModToken &tok) {
16241  token = std::make_shared<ModToken>(tok);
16242  }
16243 
16244  /**
16245  * \brief Setter for member variable \ref DiffEqExpression.expression (rvalue
16246  * reference)
16247  */
16248  void set_expression(std::shared_ptr<BinaryExpression> &&expression);
16249 
16250  /**
16251  * \brief Setter for member variable \ref DiffEqExpression.expression
16252  */
16253  void set_expression(const std::shared_ptr<BinaryExpression> &expression);
16254 
16255  /// \}
16256 
16257  /// \name Visitor
16258  /// \{
16259 
16260  /**
16261  * \brief visit children i.e. member variables of current node using provided
16262  * visitor
16263  *
16264  * Different nodes in the AST have different members (i.e. children). This
16265  * method recursively visits children using provided visitor.
16266  *
16267  * \param v Concrete visitor that will be used to recursively visit children
16268  *
16269  * \sa Ast::visit_children for example.
16270  */
16271  void visit_children(visitor::Visitor &v) override;
16272 
16273  /**
16274  * \brief accept (or visit) the current AST node using provided visitor
16275  *
16276  * Instead of visiting children of AST node, like Ast::visit_children,
16277  * accept allows to visit the current node itself using provided concrete
16278  * visitor.
16279  *
16280  * \param v Concrete visitor that will be used to recursively visit node
16281  *
16282  * \sa Ast::accept for example.
16283  */
16284  void accept(visitor::Visitor &v) override;
16285 
16286  /// \}
16287 
16288 private:
16289  /**
16290  * \brief Set this object as parent for all the children
16291  *
16292  * This should be called in every object (with children) constructor
16293  * to set parents. Since it is called only in the constructors it
16294  * should not be virtual to avoid ambiguities (issue #295).
16295  */
16296  void set_parent_in_children();
16297 };
16298 
16299 /** @} */ // end of ast_class
16300 
16301 } // namespace ast
16302 } // namespace nmodl
16303 #endif // !NMODL_AST_DIFF_EQ_EXPRESSION_HPP
16304 #ifndef NMODL_AST_UNARY_EXPRESSION_HPP
16305 #define NMODL_AST_UNARY_EXPRESSION_HPP
16306 
16307 namespace nmodl {
16308 namespace ast {
16309 
16310 /**
16311  * @addtogroup ast_class
16312  * @ingroup ast
16313  * @{
16314  */
16315 
16316 /**
16317  * \brief TODO
16318  *
16319  *
16320  */
16321 class UnaryExpression : public Expression {
16322 private:
16323  /// TODO
16325  /// TODO
16326  std::shared_ptr<Expression> expression;
16327  /// token with location information
16328  std::shared_ptr<ModToken> token;
16329 
16330 public:
16331  /// \name Ctor & dtor
16332  /// \{
16333 
16334  explicit UnaryExpression(const UnaryOperator &op, Expression *expression);
16335  explicit UnaryExpression(const UnaryOperator &op,
16336  const std::shared_ptr<Expression> &expression);
16337  UnaryExpression(const UnaryExpression &obj);
16338 
16339  virtual ~UnaryExpression() = default;
16340 
16341  /// \}
16342 
16343  /**
16344  * \brief Check if the ast node is an instance of ast::UnaryExpression
16345  * \return true as object is of type ast::UnaryExpression
16346  */
16347  bool is_unary_expression() const noexcept override { return true; }
16348 
16349  /**
16350  * \brief Return a copy of the current node
16351  *
16352  * Recursively make a new copy/clone of the current node including
16353  * all members and return a pointer to the node. This is used for
16354  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16355  * ast.
16356  *
16357  * @return pointer to the clone/copy of the current node
16358  */
16359  UnaryExpression *clone() const override { return new UnaryExpression(*this); }
16360 
16361  /// \name Getters
16362  /// \{
16363 
16364  /**
16365  * \brief Return type (ast::AstNodeType) of ast node
16366  *
16367  * Every node in the ast has a type defined in ast::AstNodeType and this
16368  * function is used to retrieve the same.
16369  *
16370  * \return ast node type i.e. ast::AstNodeType::UNARY_EXPRESSION
16371  *
16372  * \sa Ast::get_node_type_name
16373  */
16374  AstNodeType get_node_type() const noexcept override {
16376  }
16377 
16378  /**
16379  * \brief Return type (ast::AstNodeType) of ast node as std::string
16380  *
16381  * Every node in the ast has a type defined in ast::AstNodeType.
16382  * This type name can be returned as a std::string for printing
16383  * node to text/json form.
16384  *
16385  * \return name of the node type as a string i.e. "UnaryExpression"
16386  *
16387  * \sa Ast::get_node_name
16388  */
16389  std::string get_node_type_name() const noexcept override {
16390  return "UnaryExpression";
16391  }
16392 
16393  /**
16394  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16395  */
16396  std::shared_ptr<Ast> get_shared_ptr() override {
16397  return std::static_pointer_cast<UnaryExpression>(shared_from_this());
16398  }
16399 
16400  /**
16401  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16402  */
16403  std::shared_ptr<const Ast> get_shared_ptr() const override {
16404  return std::static_pointer_cast<const UnaryExpression>(shared_from_this());
16405  }
16406 
16407  /**
16408  * \brief Return associated token for the current ast node
16409  *
16410  * Not all ast nodes have token information. For example,
16411  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
16412  * solution of ODEs. In this case, we return nullptr to store in the
16413  * nmodl::symtab::SymbolTable.
16414  *
16415  * \return pointer to token if exist otherwise nullptr
16416  */
16417  const ModToken *get_token() const noexcept override { return token.get(); }
16418 
16419  /**
16420  * \brief Getter for member variable \ref UnaryExpression.op
16421  */
16422  const UnaryOperator &get_op() const noexcept { return op; }
16423 
16424  /**
16425  * \brief Getter for member variable \ref UnaryExpression.expression
16426  */
16427  const std::shared_ptr<Expression> &get_expression() const noexcept {
16428  return expression;
16429  }
16430 
16431  /// \}
16432 
16433  /// \name Setters
16434  /// \{
16435 
16436  /**
16437  * \brief Set token for the current ast node
16438  */
16439  void set_token(const ModToken &tok) {
16440  token = std::make_shared<ModToken>(tok);
16441  }
16442 
16443  /**
16444  * \brief Setter for member variable \ref UnaryExpression.op (rvalue
16445  * reference)
16446  */
16447  void set_op(UnaryOperator &&op);
16448 
16449  /**
16450  * \brief Setter for member variable \ref UnaryExpression.op
16451  */
16452  void set_op(const UnaryOperator &op);
16453 
16454  /**
16455  * \brief Setter for member variable \ref UnaryExpression.expression (rvalue
16456  * reference)
16457  */
16458  void set_expression(std::shared_ptr<Expression> &&expression);
16459 
16460  /**
16461  * \brief Setter for member variable \ref UnaryExpression.expression
16462  */
16463  void set_expression(const std::shared_ptr<Expression> &expression);
16464 
16465  /// \}
16466 
16467  /// \name Visitor
16468  /// \{
16469 
16470  /**
16471  * \brief visit children i.e. member variables of current node using provided
16472  * visitor
16473  *
16474  * Different nodes in the AST have different members (i.e. children). This
16475  * method recursively visits children using provided visitor.
16476  *
16477  * \param v Concrete visitor that will be used to recursively visit children
16478  *
16479  * \sa Ast::visit_children for example.
16480  */
16481  void visit_children(visitor::Visitor &v) override;
16482 
16483  /**
16484  * \brief accept (or visit) the current AST node using provided visitor
16485  *
16486  * Instead of visiting children of AST node, like Ast::visit_children,
16487  * accept allows to visit the current node itself using provided concrete
16488  * visitor.
16489  *
16490  * \param v Concrete visitor that will be used to recursively visit node
16491  *
16492  * \sa Ast::accept for example.
16493  */
16494  void accept(visitor::Visitor &v) override;
16495 
16496  /// \}
16497 
16498 private:
16499  /**
16500  * \brief Set this object as parent for all the children
16501  *
16502  * This should be called in every object (with children) constructor
16503  * to set parents. Since it is called only in the constructors it
16504  * should not be virtual to avoid ambiguities (issue #295).
16505  */
16506  void set_parent_in_children();
16507 };
16508 
16509 /** @} */ // end of ast_class
16510 
16511 } // namespace ast
16512 } // namespace nmodl
16513 #endif // !NMODL_AST_UNARY_EXPRESSION_HPP
16514 #ifndef NMODL_AST_NON_LIN_EQUATION_HPP
16515 #define NMODL_AST_NON_LIN_EQUATION_HPP
16516 
16517 namespace nmodl {
16518 namespace ast {
16519 
16520 /**
16521  * @addtogroup ast_class
16522  * @ingroup ast
16523  * @{
16524  */
16525 
16526 /**
16527  * \brief TODO
16528  *
16529  *
16530  */
16531 class NonLinEquation : public Expression {
16532 private:
16533  /// TODO
16534  std::shared_ptr<Expression> lhs;
16535  /// TODO
16536  std::shared_ptr<Expression> rhs;
16537  /// token with location information
16538  std::shared_ptr<ModToken> token;
16539 
16540 public:
16541  /// \name Ctor & dtor
16542  /// \{
16543 
16544  explicit NonLinEquation(Expression *lhs, Expression *rhs);
16545  explicit NonLinEquation(const std::shared_ptr<Expression> &lhs,
16546  const std::shared_ptr<Expression> &rhs);
16547  NonLinEquation(const NonLinEquation &obj);
16548 
16549  virtual ~NonLinEquation() = default;
16550 
16551  /// \}
16552 
16553  /**
16554  * \brief Check if the ast node is an instance of ast::NonLinEquation
16555  * \return true as object is of type ast::NonLinEquation
16556  */
16557  bool is_non_lin_equation() const noexcept override { return true; }
16558 
16559  /**
16560  * \brief Return a copy of the current node
16561  *
16562  * Recursively make a new copy/clone of the current node including
16563  * all members and return a pointer to the node. This is used for
16564  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16565  * ast.
16566  *
16567  * @return pointer to the clone/copy of the current node
16568  */
16569  NonLinEquation *clone() const override { return new NonLinEquation(*this); }
16570 
16571  /// \name Getters
16572  /// \{
16573 
16574  /**
16575  * \brief Return type (ast::AstNodeType) of ast node
16576  *
16577  * Every node in the ast has a type defined in ast::AstNodeType and this
16578  * function is used to retrieve the same.
16579  *
16580  * \return ast node type i.e. ast::AstNodeType::NON_LIN_EQUATION
16581  *
16582  * \sa Ast::get_node_type_name
16583  */
16584  AstNodeType get_node_type() const noexcept override {
16586  }
16587 
16588  /**
16589  * \brief Return type (ast::AstNodeType) of ast node as std::string
16590  *
16591  * Every node in the ast has a type defined in ast::AstNodeType.
16592  * This type name can be returned as a std::string for printing
16593  * node to text/json form.
16594  *
16595  * \return name of the node type as a string i.e. "NonLinEquation"
16596  *
16597  * \sa Ast::get_node_name
16598  */
16599  std::string get_node_type_name() const noexcept override {
16600  return "NonLinEquation";
16601  }
16602 
16603  /**
16604  * \brief Return NMODL statement of ast node as std::string
16605  *
16606  * Every node is related to a special statement in the NMODL. This
16607  * statement can be returned as a std::string for printing to
16608  * text/json form.
16609  *
16610  * \return name of the statement as a string i.e. "~ "
16611  *
16612  * \sa Ast::get_nmodl_name
16613  */
16614  std::string get_nmodl_name() const noexcept override { return "~ "; }
16615 
16616  /**
16617  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16618  */
16619  std::shared_ptr<Ast> get_shared_ptr() override {
16620  return std::static_pointer_cast<NonLinEquation>(shared_from_this());
16621  }
16622 
16623  /**
16624  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16625  */
16626  std::shared_ptr<const Ast> get_shared_ptr() const override {
16627  return std::static_pointer_cast<const NonLinEquation>(shared_from_this());
16628  }
16629 
16630  /**
16631  * \brief Return associated token for the current ast node
16632  *
16633  * Not all ast nodes have token information. For example,
16634  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
16635  * solution of ODEs. In this case, we return nullptr to store in the
16636  * nmodl::symtab::SymbolTable.
16637  *
16638  * \return pointer to token if exist otherwise nullptr
16639  */
16640  const ModToken *get_token() const noexcept override { return token.get(); }
16641 
16642  /**
16643  * \brief Getter for member variable \ref NonLinEquation.lhs
16644  */
16645  const std::shared_ptr<Expression> &get_lhs() const noexcept { return lhs; }
16646 
16647  /**
16648  * \brief Getter for member variable \ref NonLinEquation.rhs
16649  */
16650  const std::shared_ptr<Expression> &get_rhs() const noexcept { return rhs; }
16651 
16652  /// \}
16653 
16654  /// \name Setters
16655  /// \{
16656 
16657  /**
16658  * \brief Set token for the current ast node
16659  */
16660  void set_token(const ModToken &tok) {
16661  token = std::make_shared<ModToken>(tok);
16662  }
16663 
16664  /**
16665  * \brief Setter for member variable \ref NonLinEquation.lhs (rvalue
16666  * reference)
16667  */
16668  void set_lhs(std::shared_ptr<Expression> &&lhs);
16669 
16670  /**
16671  * \brief Setter for member variable \ref NonLinEquation.lhs
16672  */
16673  void set_lhs(const std::shared_ptr<Expression> &lhs);
16674 
16675  /**
16676  * \brief Setter for member variable \ref NonLinEquation.rhs (rvalue
16677  * reference)
16678  */
16679  void set_rhs(std::shared_ptr<Expression> &&rhs);
16680 
16681  /**
16682  * \brief Setter for member variable \ref NonLinEquation.rhs
16683  */
16684  void set_rhs(const std::shared_ptr<Expression> &rhs);
16685 
16686  /// \}
16687 
16688  /// \name Visitor
16689  /// \{
16690 
16691  /**
16692  * \brief visit children i.e. member variables of current node using provided
16693  * visitor
16694  *
16695  * Different nodes in the AST have different members (i.e. children). This
16696  * method recursively visits children using provided visitor.
16697  *
16698  * \param v Concrete visitor that will be used to recursively visit children
16699  *
16700  * \sa Ast::visit_children for example.
16701  */
16702  void visit_children(visitor::Visitor &v) override;
16703 
16704  /**
16705  * \brief accept (or visit) the current AST node using provided visitor
16706  *
16707  * Instead of visiting children of AST node, like Ast::visit_children,
16708  * accept allows to visit the current node itself using provided concrete
16709  * visitor.
16710  *
16711  * \param v Concrete visitor that will be used to recursively visit node
16712  *
16713  * \sa Ast::accept for example.
16714  */
16715  void accept(visitor::Visitor &v) override;
16716 
16717  /// \}
16718 
16719 private:
16720  /**
16721  * \brief Set this object as parent for all the children
16722  *
16723  * This should be called in every object (with children) constructor
16724  * to set parents. Since it is called only in the constructors it
16725  * should not be virtual to avoid ambiguities (issue #295).
16726  */
16727  void set_parent_in_children();
16728 };
16729 
16730 /** @} */ // end of ast_class
16731 
16732 } // namespace ast
16733 } // namespace nmodl
16734 #endif // !NMODL_AST_NON_LIN_EQUATION_HPP
16735 #ifndef NMODL_AST_LIN_EQUATION_HPP
16736 #define NMODL_AST_LIN_EQUATION_HPP
16737 
16738 namespace nmodl {
16739 namespace ast {
16740 
16741 /**
16742  * @addtogroup ast_class
16743  * @ingroup ast
16744  * @{
16745  */
16746 
16747 /**
16748  * \brief TODO
16749  *
16750  *
16751  */
16752 class LinEquation : public Expression {
16753 private:
16754  /// TODO
16755  std::shared_ptr<Expression> left_linxpression;
16756  /// TODO
16757  std::shared_ptr<Expression> linxpression;
16758  /// token with location information
16759  std::shared_ptr<ModToken> token;
16760 
16761 public:
16762  /// \name Ctor & dtor
16763  /// \{
16764 
16765  explicit LinEquation(Expression *left_linxpression, Expression *linxpression);
16766  explicit LinEquation(const std::shared_ptr<Expression> &left_linxpression,
16767  const std::shared_ptr<Expression> &linxpression);
16768  LinEquation(const LinEquation &obj);
16769 
16770  virtual ~LinEquation() = default;
16771 
16772  /// \}
16773 
16774  /**
16775  * \brief Check if the ast node is an instance of ast::LinEquation
16776  * \return true as object is of type ast::LinEquation
16777  */
16778  bool is_lin_equation() const noexcept override { return true; }
16779 
16780  /**
16781  * \brief Return a copy of the current node
16782  *
16783  * Recursively make a new copy/clone of the current node including
16784  * all members and return a pointer to the node. This is used for
16785  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16786  * ast.
16787  *
16788  * @return pointer to the clone/copy of the current node
16789  */
16790  LinEquation *clone() const override { return new LinEquation(*this); }
16791 
16792  /// \name Getters
16793  /// \{
16794 
16795  /**
16796  * \brief Return type (ast::AstNodeType) of ast node
16797  *
16798  * Every node in the ast has a type defined in ast::AstNodeType and this
16799  * function is used to retrieve the same.
16800  *
16801  * \return ast node type i.e. ast::AstNodeType::LIN_EQUATION
16802  *
16803  * \sa Ast::get_node_type_name
16804  */
16805  AstNodeType get_node_type() const noexcept override {
16807  }
16808 
16809  /**
16810  * \brief Return type (ast::AstNodeType) of ast node as std::string
16811  *
16812  * Every node in the ast has a type defined in ast::AstNodeType.
16813  * This type name can be returned as a std::string for printing
16814  * node to text/json form.
16815  *
16816  * \return name of the node type as a string i.e. "LinEquation"
16817  *
16818  * \sa Ast::get_node_name
16819  */
16820  std::string get_node_type_name() const noexcept override {
16821  return "LinEquation";
16822  }
16823 
16824  /**
16825  * \brief Return NMODL statement of ast node as std::string
16826  *
16827  * Every node is related to a special statement in the NMODL. This
16828  * statement can be returned as a std::string for printing to
16829  * text/json form.
16830  *
16831  * \return name of the statement as a string i.e. "~ "
16832  *
16833  * \sa Ast::get_nmodl_name
16834  */
16835  std::string get_nmodl_name() const noexcept override { return "~ "; }
16836 
16837  /**
16838  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16839  */
16840  std::shared_ptr<Ast> get_shared_ptr() override {
16841  return std::static_pointer_cast<LinEquation>(shared_from_this());
16842  }
16843 
16844  /**
16845  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16846  */
16847  std::shared_ptr<const Ast> get_shared_ptr() const override {
16848  return std::static_pointer_cast<const LinEquation>(shared_from_this());
16849  }
16850 
16851  /**
16852  * \brief Return associated token for the current ast node
16853  *
16854  * Not all ast nodes have token information. For example,
16855  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
16856  * solution of ODEs. In this case, we return nullptr to store in the
16857  * nmodl::symtab::SymbolTable.
16858  *
16859  * \return pointer to token if exist otherwise nullptr
16860  */
16861  const ModToken *get_token() const noexcept override { return token.get(); }
16862 
16863  /**
16864  * \brief Getter for member variable \ref LinEquation.left_linxpression
16865  */
16866  const std::shared_ptr<Expression> &get_left_linxpression() const noexcept {
16867  return left_linxpression;
16868  }
16869 
16870  /**
16871  * \brief Getter for member variable \ref LinEquation.linxpression
16872  */
16873  const std::shared_ptr<Expression> &get_linxpression() const noexcept {
16874  return linxpression;
16875  }
16876 
16877  /// \}
16878 
16879  /// \name Setters
16880  /// \{
16881 
16882  /**
16883  * \brief Set token for the current ast node
16884  */
16885  void set_token(const ModToken &tok) {
16886  token = std::make_shared<ModToken>(tok);
16887  }
16888 
16889  /**
16890  * \brief Setter for member variable \ref LinEquation.left_linxpression
16891  * (rvalue reference)
16892  */
16893  void set_left_linxpression(std::shared_ptr<Expression> &&left_linxpression);
16894 
16895  /**
16896  * \brief Setter for member variable \ref LinEquation.left_linxpression
16897  */
16898  void
16899  set_left_linxpression(const std::shared_ptr<Expression> &left_linxpression);
16900 
16901  /**
16902  * \brief Setter for member variable \ref LinEquation.linxpression (rvalue
16903  * reference)
16904  */
16905  void set_linxpression(std::shared_ptr<Expression> &&linxpression);
16906 
16907  /**
16908  * \brief Setter for member variable \ref LinEquation.linxpression
16909  */
16910  void set_linxpression(const std::shared_ptr<Expression> &linxpression);
16911 
16912  /// \}
16913 
16914  /// \name Visitor
16915  /// \{
16916 
16917  /**
16918  * \brief visit children i.e. member variables of current node using provided
16919  * visitor
16920  *
16921  * Different nodes in the AST have different members (i.e. children). This
16922  * method recursively visits children using provided visitor.
16923  *
16924  * \param v Concrete visitor that will be used to recursively visit children
16925  *
16926  * \sa Ast::visit_children for example.
16927  */
16928  void visit_children(visitor::Visitor &v) override;
16929 
16930  /**
16931  * \brief accept (or visit) the current AST node using provided visitor
16932  *
16933  * Instead of visiting children of AST node, like Ast::visit_children,
16934  * accept allows to visit the current node itself using provided concrete
16935  * visitor.
16936  *
16937  * \param v Concrete visitor that will be used to recursively visit node
16938  *
16939  * \sa Ast::accept for example.
16940  */
16941  void accept(visitor::Visitor &v) override;
16942 
16943  /// \}
16944 
16945 private:
16946  /**
16947  * \brief Set this object as parent for all the children
16948  *
16949  * This should be called in every object (with children) constructor
16950  * to set parents. Since it is called only in the constructors it
16951  * should not be virtual to avoid ambiguities (issue #295).
16952  */
16953  void set_parent_in_children();
16954 };
16955 
16956 /** @} */ // end of ast_class
16957 
16958 } // namespace ast
16959 } // namespace nmodl
16960 #endif // !NMODL_AST_LIN_EQUATION_HPP
16961 #ifndef NMODL_AST_FUNCTION_CALL_HPP
16962 #define NMODL_AST_FUNCTION_CALL_HPP
16963 
16964 namespace nmodl {
16965 namespace ast {
16966 
16967 /**
16968  * @addtogroup ast_class
16969  * @ingroup ast
16970  * @{
16971  */
16972 
16973 /**
16974  * \brief TODO
16975  *
16976  *
16977  */
16978 class FunctionCall : public Expression {
16979 private:
16980  /// TODO
16981  std::shared_ptr<Name> name;
16982  /// TODO
16984  /// token with location information
16985  std::shared_ptr<ModToken> token;
16986 
16987 public:
16988  /// \name Ctor & dtor
16989  /// \{
16990 
16991  explicit FunctionCall(Name *name, ExpressionVector arguments);
16992  explicit FunctionCall(const std::shared_ptr<Name> &name,
16993  const ExpressionVector &arguments);
16994  FunctionCall(const FunctionCall &obj);
16995 
16996  virtual ~FunctionCall() = default;
16997 
16998  /// \}
16999 
17000  /**
17001  * \brief Check if the ast node is an instance of ast::FunctionCall
17002  * \return true as object is of type ast::FunctionCall
17003  */
17004  bool is_function_call() const noexcept override { return true; }
17005 
17006  /**
17007  * \brief Return a copy of the current node
17008  *
17009  * Recursively make a new copy/clone of the current node including
17010  * all members and return a pointer to the node. This is used for
17011  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17012  * ast.
17013  *
17014  * @return pointer to the clone/copy of the current node
17015  */
17016  FunctionCall *clone() const override { return new FunctionCall(*this); }
17017 
17018  /// \name Getters
17019  /// \{
17020 
17021  /**
17022  * \brief Return type (ast::AstNodeType) of ast node
17023  *
17024  * Every node in the ast has a type defined in ast::AstNodeType and this
17025  * function is used to retrieve the same.
17026  *
17027  * \return ast node type i.e. ast::AstNodeType::FUNCTION_CALL
17028  *
17029  * \sa Ast::get_node_type_name
17030  */
17031  AstNodeType get_node_type() const noexcept override {
17033  }
17034 
17035  /**
17036  * \brief Return type (ast::AstNodeType) of ast node as std::string
17037  *
17038  * Every node in the ast has a type defined in ast::AstNodeType.
17039  * This type name can be returned as a std::string for printing
17040  * node to text/json form.
17041  *
17042  * \return name of the node type as a string i.e. "FunctionCall"
17043  *
17044  * \sa Ast::get_node_name
17045  */
17046  std::string get_node_type_name() const noexcept override {
17047  return "FunctionCall";
17048  }
17049 
17050  /**
17051  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17052  */
17053  std::shared_ptr<Ast> get_shared_ptr() override {
17054  return std::static_pointer_cast<FunctionCall>(shared_from_this());
17055  }
17056 
17057  /**
17058  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17059  */
17060  std::shared_ptr<const Ast> get_shared_ptr() const override {
17061  return std::static_pointer_cast<const FunctionCall>(shared_from_this());
17062  }
17063 
17064  /**
17065  * \brief Return associated token for the current ast node
17066  *
17067  * Not all ast nodes have token information. For example,
17068  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
17069  * solution of ODEs. In this case, we return nullptr to store in the
17070  * nmodl::symtab::SymbolTable.
17071  *
17072  * \return pointer to token if exist otherwise nullptr
17073  */
17074  const ModToken *get_token() const noexcept override { return token.get(); }
17075 
17076  /**
17077  * \brief Return name of the node
17078  *
17079  * Some ast nodes have a member marked designated as node name. For example,
17080  * in case of this ast::Name has name designated as a
17081  * node name.
17082  *
17083  * @return name of the node as std::string
17084  *
17085  * \sa Ast::get_node_type_name
17086  */
17087  std::string get_node_name() const override;
17088 
17089  /**
17090  * \brief Getter for member variable \ref FunctionCall.name
17091  */
17092  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
17093 
17094  /**
17095  * \brief Getter for member variable \ref FunctionCall.arguments
17096  */
17097  const ExpressionVector &get_arguments() const noexcept { return arguments; }
17098 
17099  /// \}
17100 
17101  /// \name Setters
17102  /// \{
17103 
17104  /**
17105  * \brief Set token for the current ast node
17106  */
17107  void set_token(const ModToken &tok) {
17108  token = std::make_shared<ModToken>(tok);
17109  }
17110 
17111  /**
17112  * \brief Setter for member variable \ref FunctionCall.name (rvalue reference)
17113  */
17114  void set_name(std::shared_ptr<Name> &&name);
17115 
17116  /**
17117  * \brief Setter for member variable \ref FunctionCall.name
17118  */
17119  void set_name(const std::shared_ptr<Name> &name);
17120 
17121  /**
17122  * \brief Setter for member variable \ref FunctionCall.arguments (rvalue
17123  * reference)
17124  */
17125  void set_arguments(ExpressionVector &&arguments);
17126 
17127  /**
17128  * \brief Setter for member variable \ref FunctionCall.arguments
17129  */
17130  void set_arguments(const ExpressionVector &arguments);
17131 
17132  /// \}
17133 
17134  /// \name Visitor
17135  /// \{
17136 
17137  /**
17138  * \brief visit children i.e. member variables of current node using provided
17139  * visitor
17140  *
17141  * Different nodes in the AST have different members (i.e. children). This
17142  * method recursively visits children using provided visitor.
17143  *
17144  * \param v Concrete visitor that will be used to recursively visit children
17145  *
17146  * \sa Ast::visit_children for example.
17147  */
17148  void visit_children(visitor::Visitor &v) override;
17149 
17150  /**
17151  * \brief accept (or visit) the current AST node using provided visitor
17152  *
17153  * Instead of visiting children of AST node, like Ast::visit_children,
17154  * accept allows to visit the current node itself using provided concrete
17155  * visitor.
17156  *
17157  * \param v Concrete visitor that will be used to recursively visit node
17158  *
17159  * \sa Ast::accept for example.
17160  */
17161  void accept(visitor::Visitor &v) override;
17162 
17163  /// \}
17164 
17165 private:
17166  /**
17167  * \brief Set this object as parent for all the children
17168  *
17169  * This should be called in every object (with children) constructor
17170  * to set parents. Since it is called only in the constructors it
17171  * should not be virtual to avoid ambiguities (issue #295).
17172  */
17173  void set_parent_in_children();
17174 };
17175 
17176 /** @} */ // end of ast_class
17177 
17178 } // namespace ast
17179 } // namespace nmodl
17180 #endif // !NMODL_AST_FUNCTION_CALL_HPP
17181 #ifndef NMODL_AST_FIRST_LAST_TYPE_INDEX_HPP
17182 #define NMODL_AST_FIRST_LAST_TYPE_INDEX_HPP
17183 
17184 namespace nmodl {
17185 namespace ast {
17186 
17187 /**
17188  * @addtogroup ast_class
17189  * @ingroup ast
17190  * @{
17191  */
17192 
17193 /**
17194  * \brief TODO
17195  *
17196  *
17197  */
17199 private:
17200  /// TODO
17202  /// token with location information
17203  std::shared_ptr<ModToken> token;
17204 
17205 public:
17206  /// \name Ctor & dtor
17207  /// \{
17208 
17209  explicit FirstLastTypeIndex(FirstLastType value);
17211 
17212  virtual ~FirstLastTypeIndex() = default;
17213 
17214  /// \}
17215 
17216  /**
17217  * \brief Check if the ast node is an instance of ast::FirstLastTypeIndex
17218  * \return true as object is of type ast::FirstLastTypeIndex
17219  */
17220  bool is_first_last_type_index() const noexcept override { return true; }
17221 
17222  /**
17223  * \brief Return a copy of the current node
17224  *
17225  * Recursively make a new copy/clone of the current node including
17226  * all members and return a pointer to the node. This is used for
17227  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17228  * ast.
17229  *
17230  * @return pointer to the clone/copy of the current node
17231  */
17232  FirstLastTypeIndex *clone() const override {
17233  return new FirstLastTypeIndex(*this);
17234  }
17235 
17236  /// \name Getters
17237  /// \{
17238 
17239  /**
17240  * \brief Return type (ast::AstNodeType) of ast node
17241  *
17242  * Every node in the ast has a type defined in ast::AstNodeType and this
17243  * function is used to retrieve the same.
17244  *
17245  * \return ast node type i.e. ast::AstNodeType::FIRST_LAST_TYPE_INDEX
17246  *
17247  * \sa Ast::get_node_type_name
17248  */
17249  AstNodeType get_node_type() const noexcept override {
17251  }
17252 
17253  /**
17254  * \brief Return type (ast::AstNodeType) of ast node as std::string
17255  *
17256  * Every node in the ast has a type defined in ast::AstNodeType.
17257  * This type name can be returned as a std::string for printing
17258  * node to text/json form.
17259  *
17260  * \return name of the node type as a string i.e. "FirstLastTypeIndex"
17261  *
17262  * \sa Ast::get_node_name
17263  */
17264  std::string get_node_type_name() const noexcept override {
17265  return "FirstLastTypeIndex";
17266  }
17267 
17268  /**
17269  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17270  */
17271  std::shared_ptr<Ast> get_shared_ptr() override {
17272  return std::static_pointer_cast<FirstLastTypeIndex>(shared_from_this());
17273  }
17274 
17275  /**
17276  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17277  */
17278  std::shared_ptr<const Ast> get_shared_ptr() const override {
17279  return std::static_pointer_cast<const FirstLastTypeIndex>(
17280  shared_from_this());
17281  }
17282 
17283  /**
17284  * \brief Return associated token for the current ast node
17285  *
17286  * Not all ast nodes have token information. For example,
17287  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
17288  * solution of ODEs. In this case, we return nullptr to store in the
17289  * nmodl::symtab::SymbolTable.
17290  *
17291  * \return pointer to token if exist otherwise nullptr
17292  */
17293  const ModToken *get_token() const noexcept override { return token.get(); }
17294 
17295  /**
17296  * \brief Getter for member variable \ref FirstLastTypeIndex.value
17297  */
17298  FirstLastType get_value() const noexcept { return value; }
17299 
17300  /// \}
17301 
17302  /// \name Setters
17303  /// \{
17304 
17305  /**
17306  * \brief Set token for the current ast node
17307  */
17308  void set_token(const ModToken &tok) {
17309  token = std::make_shared<ModToken>(tok);
17310  }
17311 
17312  /**
17313  * \brief Setter for member variable \ref FirstLastTypeIndex.value
17314  */
17315  void set_value(FirstLastType value);
17316 
17317  /// \}
17318 
17319  /// \name Visitor
17320  /// \{
17321 
17322  /**
17323  * \brief visit children i.e. member variables of current node using provided
17324  * visitor
17325  *
17326  * Different nodes in the AST have different members (i.e. children). This
17327  * method recursively visits children using provided visitor.
17328  *
17329  * \param v Concrete visitor that will be used to recursively visit children
17330  *
17331  * \sa Ast::visit_children for example.
17332  */
17333  void visit_children(visitor::Visitor &v) override;
17334 
17335  /**
17336  * \brief accept (or visit) the current AST node using provided visitor
17337  *
17338  * Instead of visiting children of AST node, like Ast::visit_children,
17339  * accept allows to visit the current node itself using provided concrete
17340  * visitor.
17341  *
17342  * \param v Concrete visitor that will be used to recursively visit node
17343  *
17344  * \sa Ast::accept for example.
17345  */
17346  void accept(visitor::Visitor &v) override;
17347 
17348  /// \}
17349 
17350  /**
17351  * \brief Return enum value in string form
17352  *
17353  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
17354  * string representation when they are converted from AST back to
17355  * NMODL. This method is used to return corresponding string representation.
17356  */
17357  std::string eval() const { return FirstLastTypeNames[value]; }
17358 
17359 private:
17360  /**
17361  * \brief Set this object as parent for all the children
17362  *
17363  * This should be called in every object (with children) constructor
17364  * to set parents. Since it is called only in the constructors it
17365  * should not be virtual to avoid ambiguities (issue #295).
17366  */
17367  void set_parent_in_children();
17368 };
17369 
17370 /** @} */ // end of ast_class
17371 
17372 } // namespace ast
17373 } // namespace nmodl
17374 #endif // !NMODL_AST_FIRST_LAST_TYPE_INDEX_HPP
17375 #ifndef NMODL_AST_WATCH_HPP
17376 #define NMODL_AST_WATCH_HPP
17377 
17378 namespace nmodl {
17379 namespace ast {
17380 
17381 /**
17382  * @addtogroup ast_class
17383  * @ingroup ast
17384  * @{
17385  */
17386 
17387 /**
17388  * \brief TODO
17389  *
17390  *
17391  */
17392 class Watch : public Expression {
17393 private:
17394  /// TODO
17395  std::shared_ptr<Expression> expression;
17396  /// TODO
17397  std::shared_ptr<Expression> value;
17398  /// token with location information
17399  std::shared_ptr<ModToken> token;
17400 
17401 public:
17402  /// \name Ctor & dtor
17403  /// \{
17404 
17405  explicit Watch(Expression *expression, Expression *value);
17406  explicit Watch(const std::shared_ptr<Expression> &expression,
17407  const std::shared_ptr<Expression> &value);
17408  Watch(const Watch &obj);
17409 
17410  virtual ~Watch() = default;
17411 
17412  /// \}
17413 
17414  /**
17415  * \brief Check if the ast node is an instance of ast::Watch
17416  * \return true as object is of type ast::Watch
17417  */
17418  bool is_watch() const noexcept override { return true; }
17419 
17420  /**
17421  * \brief Return a copy of the current node
17422  *
17423  * Recursively make a new copy/clone of the current node including
17424  * all members and return a pointer to the node. This is used for
17425  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17426  * ast.
17427  *
17428  * @return pointer to the clone/copy of the current node
17429  */
17430  Watch *clone() const override { return new Watch(*this); }
17431 
17432  /// \name Getters
17433  /// \{
17434 
17435  /**
17436  * \brief Return type (ast::AstNodeType) of ast node
17437  *
17438  * Every node in the ast has a type defined in ast::AstNodeType and this
17439  * function is used to retrieve the same.
17440  *
17441  * \return ast node type i.e. ast::AstNodeType::WATCH
17442  *
17443  * \sa Ast::get_node_type_name
17444  */
17445  AstNodeType get_node_type() const noexcept override {
17446  return AstNodeType::WATCH;
17447  }
17448 
17449  /**
17450  * \brief Return type (ast::AstNodeType) of ast node as std::string
17451  *
17452  * Every node in the ast has a type defined in ast::AstNodeType.
17453  * This type name can be returned as a std::string for printing
17454  * node to text/json form.
17455  *
17456  * \return name of the node type as a string i.e. "Watch"
17457  *
17458  * \sa Ast::get_node_name
17459  */
17460  std::string get_node_type_name() const noexcept override { return "Watch"; }
17461 
17462  /**
17463  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17464  */
17465  std::shared_ptr<Ast> get_shared_ptr() override {
17466  return std::static_pointer_cast<Watch>(shared_from_this());
17467  }
17468 
17469  /**
17470  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17471  */
17472  std::shared_ptr<const Ast> get_shared_ptr() const override {
17473  return std::static_pointer_cast<const Watch>(shared_from_this());
17474  }
17475 
17476  /**
17477  * \brief Return associated token for the current ast node
17478  *
17479  * Not all ast nodes have token information. For example,
17480  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
17481  * solution of ODEs. In this case, we return nullptr to store in the
17482  * nmodl::symtab::SymbolTable.
17483  *
17484  * \return pointer to token if exist otherwise nullptr
17485  */
17486  const ModToken *get_token() const noexcept override { return token.get(); }
17487 
17488  /**
17489  * \brief Getter for member variable \ref Watch.expression
17490  */
17491  const std::shared_ptr<Expression> &get_expression() const noexcept {
17492  return expression;
17493  }
17494 
17495  /**
17496  * \brief Getter for member variable \ref Watch.value
17497  */
17498  const std::shared_ptr<Expression> &get_value() const noexcept {
17499  return value;
17500  }
17501 
17502  /// \}
17503 
17504  /// \name Setters
17505  /// \{
17506 
17507  /**
17508  * \brief Set token for the current ast node
17509  */
17510  void set_token(const ModToken &tok) {
17511  token = std::make_shared<ModToken>(tok);
17512  }
17513 
17514  /**
17515  * \brief Setter for member variable \ref Watch.expression (rvalue reference)
17516  */
17517  void set_expression(std::shared_ptr<Expression> &&expression);
17518 
17519  /**
17520  * \brief Setter for member variable \ref Watch.expression
17521  */
17522  void set_expression(const std::shared_ptr<Expression> &expression);
17523 
17524  /**
17525  * \brief Setter for member variable \ref Watch.value (rvalue reference)
17526  */
17527  void set_value(std::shared_ptr<Expression> &&value);
17528 
17529  /**
17530  * \brief Setter for member variable \ref Watch.value
17531  */
17532  void set_value(const std::shared_ptr<Expression> &value);
17533 
17534  /// \}
17535 
17536  /// \name Visitor
17537  /// \{
17538 
17539  /**
17540  * \brief visit children i.e. member variables of current node using provided
17541  * visitor
17542  *
17543  * Different nodes in the AST have different members (i.e. children). This
17544  * method recursively visits children using provided visitor.
17545  *
17546  * \param v Concrete visitor that will be used to recursively visit children
17547  *
17548  * \sa Ast::visit_children for example.
17549  */
17550  void visit_children(visitor::Visitor &v) override;
17551 
17552  /**
17553  * \brief accept (or visit) the current AST node using provided visitor
17554  *
17555  * Instead of visiting children of AST node, like Ast::visit_children,
17556  * accept allows to visit the current node itself using provided concrete
17557  * visitor.
17558  *
17559  * \param v Concrete visitor that will be used to recursively visit node
17560  *
17561  * \sa Ast::accept for example.
17562  */
17563  void accept(visitor::Visitor &v) override;
17564 
17565  /// \}
17566 
17567 private:
17568  /**
17569  * \brief Set this object as parent for all the children
17570  *
17571  * This should be called in every object (with children) constructor
17572  * to set parents. Since it is called only in the constructors it
17573  * should not be virtual to avoid ambiguities (issue #295).
17574  */
17575  void set_parent_in_children();
17576 };
17577 
17578 /** @} */ // end of ast_class
17579 
17580 } // namespace ast
17581 } // namespace nmodl
17582 #endif // !NMODL_AST_WATCH_HPP
17583 #ifndef NMODL_AST_QUEUE_EXPRESSION_TYPE_HPP
17584 #define NMODL_AST_QUEUE_EXPRESSION_TYPE_HPP
17585 
17586 namespace nmodl {
17587 namespace ast {
17588 
17589 /**
17590  * @addtogroup ast_class
17591  * @ingroup ast
17592  * @{
17593  */
17594 
17595 /**
17596  * \brief TODO
17597  *
17598  *
17599  */
17601 private:
17602  /// TODO
17604  /// token with location information
17605  std::shared_ptr<ModToken> token;
17606 
17607 public:
17608  /// \name Ctor & dtor
17609  /// \{
17610 
17611  explicit QueueExpressionType(QueueType value);
17613 
17614  virtual ~QueueExpressionType() = default;
17615 
17616  /// \}
17617 
17618  /**
17619  * \brief Check if the ast node is an instance of ast::QueueExpressionType
17620  * \return true as object is of type ast::QueueExpressionType
17621  */
17622  bool is_queue_expression_type() const noexcept override { return true; }
17623 
17624  /**
17625  * \brief Return a copy of the current node
17626  *
17627  * Recursively make a new copy/clone of the current node including
17628  * all members and return a pointer to the node. This is used for
17629  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17630  * ast.
17631  *
17632  * @return pointer to the clone/copy of the current node
17633  */
17634  QueueExpressionType *clone() const override {
17635  return new QueueExpressionType(*this);
17636  }
17637 
17638  /// \name Getters
17639  /// \{
17640 
17641  /**
17642  * \brief Return type (ast::AstNodeType) of ast node
17643  *
17644  * Every node in the ast has a type defined in ast::AstNodeType and this
17645  * function is used to retrieve the same.
17646  *
17647  * \return ast node type i.e. ast::AstNodeType::QUEUE_EXPRESSION_TYPE
17648  *
17649  * \sa Ast::get_node_type_name
17650  */
17651  AstNodeType get_node_type() const noexcept override {
17653  }
17654 
17655  /**
17656  * \brief Return type (ast::AstNodeType) of ast node as std::string
17657  *
17658  * Every node in the ast has a type defined in ast::AstNodeType.
17659  * This type name can be returned as a std::string for printing
17660  * node to text/json form.
17661  *
17662  * \return name of the node type as a string i.e. "QueueExpressionType"
17663  *
17664  * \sa Ast::get_node_name
17665  */
17666  std::string get_node_type_name() const noexcept override {
17667  return "QueueExpressionType";
17668  }
17669 
17670  /**
17671  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17672  */
17673  std::shared_ptr<Ast> get_shared_ptr() override {
17674  return std::static_pointer_cast<QueueExpressionType>(shared_from_this());
17675  }
17676 
17677  /**
17678  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17679  */
17680  std::shared_ptr<const Ast> get_shared_ptr() const override {
17681  return std::static_pointer_cast<const QueueExpressionType>(
17682  shared_from_this());
17683  }
17684 
17685  /**
17686  * \brief Return associated token for the current ast node
17687  *
17688  * Not all ast nodes have token information. For example,
17689  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
17690  * solution of ODEs. In this case, we return nullptr to store in the
17691  * nmodl::symtab::SymbolTable.
17692  *
17693  * \return pointer to token if exist otherwise nullptr
17694  */
17695  const ModToken *get_token() const noexcept override { return token.get(); }
17696 
17697  /**
17698  * \brief Getter for member variable \ref QueueExpressionType.value
17699  */
17700  QueueType get_value() const noexcept { return value; }
17701 
17702  /// \}
17703 
17704  /// \name Setters
17705  /// \{
17706 
17707  /**
17708  * \brief Set token for the current ast node
17709  */
17710  void set_token(const ModToken &tok) {
17711  token = std::make_shared<ModToken>(tok);
17712  }
17713 
17714  /**
17715  * \brief Setter for member variable \ref QueueExpressionType.value
17716  */
17717  void set_value(QueueType value);
17718 
17719  /// \}
17720 
17721  /// \name Visitor
17722  /// \{
17723 
17724  /**
17725  * \brief visit children i.e. member variables of current node using provided
17726  * visitor
17727  *
17728  * Different nodes in the AST have different members (i.e. children). This
17729  * method recursively visits children using provided visitor.
17730  *
17731  * \param v Concrete visitor that will be used to recursively visit children
17732  *
17733  * \sa Ast::visit_children for example.
17734  */
17735  void visit_children(visitor::Visitor &v) override;
17736 
17737  /**
17738  * \brief accept (or visit) the current AST node using provided visitor
17739  *
17740  * Instead of visiting children of AST node, like Ast::visit_children,
17741  * accept allows to visit the current node itself using provided concrete
17742  * visitor.
17743  *
17744  * \param v Concrete visitor that will be used to recursively visit node
17745  *
17746  * \sa Ast::accept for example.
17747  */
17748  void accept(visitor::Visitor &v) override;
17749 
17750  /// \}
17751 
17752  /**
17753  * \brief Return enum value in string form
17754  *
17755  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
17756  * string representation when they are converted from AST back to
17757  * NMODL. This method is used to return corresponding string representation.
17758  */
17759  std::string eval() const { return QueueTypeNames[value]; }
17760 
17761 private:
17762  /**
17763  * \brief Set this object as parent for all the children
17764  *
17765  * This should be called in every object (with children) constructor
17766  * to set parents. Since it is called only in the constructors it
17767  * should not be virtual to avoid ambiguities (issue #295).
17768  */
17769  void set_parent_in_children();
17770 };
17771 
17772 /** @} */ // end of ast_class
17773 
17774 } // namespace ast
17775 } // namespace nmodl
17776 #endif // !NMODL_AST_QUEUE_EXPRESSION_TYPE_HPP
17777 #ifndef NMODL_AST_MATCH_HPP
17778 #define NMODL_AST_MATCH_HPP
17779 
17780 namespace nmodl {
17781 namespace ast {
17782 
17783 /**
17784  * @addtogroup ast_class
17785  * @ingroup ast
17786  * @{
17787  */
17788 
17789 /**
17790  * \brief TODO
17791  *
17792  *
17793  */
17794 class Match : public Expression {
17795 private:
17796  /// TODO
17797  std::shared_ptr<Identifier> name;
17798  /// TODO
17799  std::shared_ptr<Expression> expression;
17800  /// token with location information
17801  std::shared_ptr<ModToken> token;
17802 
17803 public:
17804  /// \name Ctor & dtor
17805  /// \{
17806 
17807  explicit Match(Identifier *name, Expression *expression);
17808  explicit Match(const std::shared_ptr<Identifier> &name,
17809  const std::shared_ptr<Expression> &expression);
17810  Match(const Match &obj);
17811 
17812  virtual ~Match() = default;
17813 
17814  /// \}
17815 
17816  /**
17817  * \brief Check if the ast node is an instance of ast::Match
17818  * \return true as object is of type ast::Match
17819  */
17820  bool is_match() const noexcept override { return true; }
17821 
17822  /**
17823  * \brief Return a copy of the current node
17824  *
17825  * Recursively make a new copy/clone of the current node including
17826  * all members and return a pointer to the node. This is used for
17827  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17828  * ast.
17829  *
17830  * @return pointer to the clone/copy of the current node
17831  */
17832  Match *clone() const override { return new Match(*this); }
17833 
17834  /// \name Getters
17835  /// \{
17836 
17837  /**
17838  * \brief Return type (ast::AstNodeType) of ast node
17839  *
17840  * Every node in the ast has a type defined in ast::AstNodeType and this
17841  * function is used to retrieve the same.
17842  *
17843  * \return ast node type i.e. ast::AstNodeType::MATCH
17844  *
17845  * \sa Ast::get_node_type_name
17846  */
17847  AstNodeType get_node_type() const noexcept override {
17848  return AstNodeType::MATCH;
17849  }
17850 
17851  /**
17852  * \brief Return type (ast::AstNodeType) of ast node as std::string
17853  *
17854  * Every node in the ast has a type defined in ast::AstNodeType.
17855  * This type name can be returned as a std::string for printing
17856  * node to text/json form.
17857  *
17858  * \return name of the node type as a string i.e. "Match"
17859  *
17860  * \sa Ast::get_node_name
17861  */
17862  std::string get_node_type_name() const noexcept override { return "Match"; }
17863 
17864  /**
17865  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17866  */
17867  std::shared_ptr<Ast> get_shared_ptr() override {
17868  return std::static_pointer_cast<Match>(shared_from_this());
17869  }
17870 
17871  /**
17872  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17873  */
17874  std::shared_ptr<const Ast> get_shared_ptr() const override {
17875  return std::static_pointer_cast<const Match>(shared_from_this());
17876  }
17877 
17878  /**
17879  * \brief Return associated token for the current ast node
17880  *
17881  * Not all ast nodes have token information. For example,
17882  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
17883  * solution of ODEs. In this case, we return nullptr to store in the
17884  * nmodl::symtab::SymbolTable.
17885  *
17886  * \return pointer to token if exist otherwise nullptr
17887  */
17888  const ModToken *get_token() const noexcept override { return token.get(); }
17889 
17890  /**
17891  * \brief Getter for member variable \ref Match.name
17892  */
17893  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
17894 
17895  /**
17896  * \brief Getter for member variable \ref Match.expression
17897  */
17898  const std::shared_ptr<Expression> &get_expression() const noexcept {
17899  return expression;
17900  }
17901 
17902  /// \}
17903 
17904  /// \name Setters
17905  /// \{
17906 
17907  /**
17908  * \brief Set token for the current ast node
17909  */
17910  void set_token(const ModToken &tok) {
17911  token = std::make_shared<ModToken>(tok);
17912  }
17913 
17914  /**
17915  * \brief Setter for member variable \ref Match.name (rvalue reference)
17916  */
17917  void set_name(std::shared_ptr<Identifier> &&name);
17918 
17919  /**
17920  * \brief Setter for member variable \ref Match.name
17921  */
17922  void set_name(const std::shared_ptr<Identifier> &name);
17923 
17924  /**
17925  * \brief Setter for member variable \ref Match.expression (rvalue reference)
17926  */
17927  void set_expression(std::shared_ptr<Expression> &&expression);
17928 
17929  /**
17930  * \brief Setter for member variable \ref Match.expression
17931  */
17932  void set_expression(const std::shared_ptr<Expression> &expression);
17933 
17934  /// \}
17935 
17936  /// \name Visitor
17937  /// \{
17938 
17939  /**
17940  * \brief visit children i.e. member variables of current node using provided
17941  * visitor
17942  *
17943  * Different nodes in the AST have different members (i.e. children). This
17944  * method recursively visits children using provided visitor.
17945  *
17946  * \param v Concrete visitor that will be used to recursively visit children
17947  *
17948  * \sa Ast::visit_children for example.
17949  */
17950  void visit_children(visitor::Visitor &v) override;
17951 
17952  /**
17953  * \brief accept (or visit) the current AST node using provided visitor
17954  *
17955  * Instead of visiting children of AST node, like Ast::visit_children,
17956  * accept allows to visit the current node itself using provided concrete
17957  * visitor.
17958  *
17959  * \param v Concrete visitor that will be used to recursively visit node
17960  *
17961  * \sa Ast::accept for example.
17962  */
17963  void accept(visitor::Visitor &v) override;
17964 
17965  /// \}
17966 
17967 private:
17968  /**
17969  * \brief Set this object as parent for all the children
17970  *
17971  * This should be called in every object (with children) constructor
17972  * to set parents. Since it is called only in the constructors it
17973  * should not be virtual to avoid ambiguities (issue #295).
17974  */
17975  void set_parent_in_children();
17976 };
17977 
17978 /** @} */ // end of ast_class
17979 
17980 } // namespace ast
17981 } // namespace nmodl
17982 #endif // !NMODL_AST_MATCH_HPP
17983 #ifndef NMODL_AST_BA_BLOCK_TYPE_HPP
17984 #define NMODL_AST_BA_BLOCK_TYPE_HPP
17985 
17986 namespace nmodl {
17987 namespace ast {
17988 
17989 /**
17990  * @addtogroup ast_class
17991  * @ingroup ast
17992  * @{
17993  */
17994 
17995 /**
17996  * \brief Type to represent different block types for before/after block
17997  *
17998  * Different NMODL blocks can be used with ast::BeforeBlock and ast::AfterBlock.
17999  * This type is used to represent such block types.
18000  *
18001  * \sa ast::BeforeBlock as::AfterBlock
18002  *
18003  */
18004 class BABlockType : public Expression {
18005 private:
18006  /// block type
18008  /// token with location information
18009  std::shared_ptr<ModToken> token;
18010 
18011 public:
18012  /// \name Ctor & dtor
18013  /// \{
18014 
18015  explicit BABlockType(BAType value);
18016  BABlockType(const BABlockType &obj);
18017 
18018  virtual ~BABlockType() = default;
18019 
18020  /// \}
18021 
18022  /**
18023  * \brief Check if the ast node is an instance of ast::BABlockType
18024  * \return true as object is of type ast::BABlockType
18025  */
18026  bool is_ba_block_type() const noexcept override { return true; }
18027 
18028  /**
18029  * \brief Return a copy of the current node
18030  *
18031  * Recursively make a new copy/clone of the current node including
18032  * all members and return a pointer to the node. This is used for
18033  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18034  * ast.
18035  *
18036  * @return pointer to the clone/copy of the current node
18037  */
18038  BABlockType *clone() const override { return new BABlockType(*this); }
18039 
18040  /// \name Getters
18041  /// \{
18042 
18043  /**
18044  * \brief Return type (ast::AstNodeType) of ast node
18045  *
18046  * Every node in the ast has a type defined in ast::AstNodeType and this
18047  * function is used to retrieve the same.
18048  *
18049  * \return ast node type i.e. ast::AstNodeType::BA_BLOCK_TYPE
18050  *
18051  * \sa Ast::get_node_type_name
18052  */
18053  AstNodeType get_node_type() const noexcept override {
18055  }
18056 
18057  /**
18058  * \brief Return type (ast::AstNodeType) of ast node as std::string
18059  *
18060  * Every node in the ast has a type defined in ast::AstNodeType.
18061  * This type name can be returned as a std::string for printing
18062  * node to text/json form.
18063  *
18064  * \return name of the node type as a string i.e. "BABlockType"
18065  *
18066  * \sa Ast::get_node_name
18067  */
18068  std::string get_node_type_name() const noexcept override {
18069  return "BABlockType";
18070  }
18071 
18072  /**
18073  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18074  */
18075  std::shared_ptr<Ast> get_shared_ptr() override {
18076  return std::static_pointer_cast<BABlockType>(shared_from_this());
18077  }
18078 
18079  /**
18080  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18081  */
18082  std::shared_ptr<const Ast> get_shared_ptr() const override {
18083  return std::static_pointer_cast<const BABlockType>(shared_from_this());
18084  }
18085 
18086  /**
18087  * \brief Return associated token for the current ast node
18088  *
18089  * Not all ast nodes have token information. For example,
18090  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18091  * solution of ODEs. In this case, we return nullptr to store in the
18092  * nmodl::symtab::SymbolTable.
18093  *
18094  * \return pointer to token if exist otherwise nullptr
18095  */
18096  const ModToken *get_token() const noexcept override { return token.get(); }
18097 
18098  /**
18099  * \brief Getter for member variable \ref BABlockType.value
18100  */
18101  BAType get_value() const noexcept { return value; }
18102 
18103  /// \}
18104 
18105  /// \name Setters
18106  /// \{
18107 
18108  /**
18109  * \brief Set token for the current ast node
18110  */
18111  void set_token(const ModToken &tok) {
18112  token = std::make_shared<ModToken>(tok);
18113  }
18114 
18115  /**
18116  * \brief Setter for member variable \ref BABlockType.value
18117  */
18118  void set_value(BAType value);
18119 
18120  /// \}
18121 
18122  /// \name Visitor
18123  /// \{
18124 
18125  /**
18126  * \brief visit children i.e. member variables of current node using provided
18127  * visitor
18128  *
18129  * Different nodes in the AST have different members (i.e. children). This
18130  * method recursively visits children using provided visitor.
18131  *
18132  * \param v Concrete visitor that will be used to recursively visit children
18133  *
18134  * \sa Ast::visit_children for example.
18135  */
18136  void visit_children(visitor::Visitor &v) override;
18137 
18138  /**
18139  * \brief accept (or visit) the current AST node using provided visitor
18140  *
18141  * Instead of visiting children of AST node, like Ast::visit_children,
18142  * accept allows to visit the current node itself using provided concrete
18143  * visitor.
18144  *
18145  * \param v Concrete visitor that will be used to recursively visit node
18146  *
18147  * \sa Ast::accept for example.
18148  */
18149  void accept(visitor::Visitor &v) override;
18150 
18151  /// \}
18152 
18153  /**
18154  * \brief Return enum value in string form
18155  *
18156  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
18157  * string representation when they are converted from AST back to
18158  * NMODL. This method is used to return corresponding string representation.
18159  */
18160  std::string eval() const { return BATypeNames[value]; }
18161 
18162 private:
18163  /**
18164  * \brief Set this object as parent for all the children
18165  *
18166  * This should be called in every object (with children) constructor
18167  * to set parents. Since it is called only in the constructors it
18168  * should not be virtual to avoid ambiguities (issue #295).
18169  */
18170  void set_parent_in_children();
18171 };
18172 
18173 /** @} */ // end of ast_class
18174 
18175 } // namespace ast
18176 } // namespace nmodl
18177 #endif // !NMODL_AST_BA_BLOCK_TYPE_HPP
18178 #ifndef NMODL_AST_UNIT_DEF_HPP
18179 #define NMODL_AST_UNIT_DEF_HPP
18180 
18181 namespace nmodl {
18182 namespace ast {
18183 
18184 /**
18185  * @addtogroup ast_class
18186  * @ingroup ast
18187  * @{
18188  */
18189 
18190 /**
18191  * \brief TODO
18192  *
18193  *
18194  */
18195 class UnitDef : public Expression {
18196 private:
18197  /// TODO
18198  std::shared_ptr<Unit> unit1;
18199  /// TODO
18200  std::shared_ptr<Unit> unit2;
18201  /// token with location information
18202  std::shared_ptr<ModToken> token;
18203 
18204 public:
18205  /// \name Ctor & dtor
18206  /// \{
18207 
18208  explicit UnitDef(Unit *unit1, Unit *unit2);
18209  explicit UnitDef(const std::shared_ptr<Unit> &unit1,
18210  const std::shared_ptr<Unit> &unit2);
18211  UnitDef(const UnitDef &obj);
18212 
18213  virtual ~UnitDef() = default;
18214 
18215  /// \}
18216 
18217  /**
18218  * \brief Check if the ast node is an instance of ast::UnitDef
18219  * \return true as object is of type ast::UnitDef
18220  */
18221  bool is_unit_def() const noexcept override { return true; }
18222 
18223  /**
18224  * \brief Return a copy of the current node
18225  *
18226  * Recursively make a new copy/clone of the current node including
18227  * all members and return a pointer to the node. This is used for
18228  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18229  * ast.
18230  *
18231  * @return pointer to the clone/copy of the current node
18232  */
18233  UnitDef *clone() const override { return new UnitDef(*this); }
18234 
18235  /// \name Getters
18236  /// \{
18237 
18238  /**
18239  * \brief Return type (ast::AstNodeType) of ast node
18240  *
18241  * Every node in the ast has a type defined in ast::AstNodeType and this
18242  * function is used to retrieve the same.
18243  *
18244  * \return ast node type i.e. ast::AstNodeType::UNIT_DEF
18245  *
18246  * \sa Ast::get_node_type_name
18247  */
18248  AstNodeType get_node_type() const noexcept override {
18249  return AstNodeType::UNIT_DEF;
18250  }
18251 
18252  /**
18253  * \brief Return type (ast::AstNodeType) of ast node as std::string
18254  *
18255  * Every node in the ast has a type defined in ast::AstNodeType.
18256  * This type name can be returned as a std::string for printing
18257  * node to text/json form.
18258  *
18259  * \return name of the node type as a string i.e. "UnitDef"
18260  *
18261  * \sa Ast::get_node_name
18262  */
18263  std::string get_node_type_name() const noexcept override { return "UnitDef"; }
18264 
18265  /**
18266  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18267  */
18268  std::shared_ptr<Ast> get_shared_ptr() override {
18269  return std::static_pointer_cast<UnitDef>(shared_from_this());
18270  }
18271 
18272  /**
18273  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18274  */
18275  std::shared_ptr<const Ast> get_shared_ptr() const override {
18276  return std::static_pointer_cast<const UnitDef>(shared_from_this());
18277  }
18278 
18279  /**
18280  * \brief Return associated token for the current ast node
18281  *
18282  * Not all ast nodes have token information. For example,
18283  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18284  * solution of ODEs. In this case, we return nullptr to store in the
18285  * nmodl::symtab::SymbolTable.
18286  *
18287  * \return pointer to token if exist otherwise nullptr
18288  */
18289  const ModToken *get_token() const noexcept override { return token.get(); }
18290 
18291  /**
18292  * \brief Return name of the node
18293  *
18294  * Some ast nodes have a member marked designated as node name. For example,
18295  * in case of this ast::Unit has unit1 designated as a
18296  * node name.
18297  *
18298  * @return name of the node as std::string
18299  *
18300  * \sa Ast::get_node_type_name
18301  */
18302  std::string get_node_name() const override;
18303 
18304  /**
18305  * \brief Getter for member variable \ref UnitDef.unit1
18306  */
18307  const std::shared_ptr<Unit> &get_unit1() const noexcept { return unit1; }
18308 
18309  /**
18310  * \brief Getter for member variable \ref UnitDef.unit2
18311  */
18312  const std::shared_ptr<Unit> &get_unit2() const noexcept { return unit2; }
18313 
18314  /// \}
18315 
18316  /// \name Setters
18317  /// \{
18318 
18319  /**
18320  * \brief Set token for the current ast node
18321  */
18322  void set_token(const ModToken &tok) {
18323  token = std::make_shared<ModToken>(tok);
18324  }
18325 
18326  /**
18327  * \brief Setter for member variable \ref UnitDef.unit1 (rvalue reference)
18328  */
18329  void set_unit1(std::shared_ptr<Unit> &&unit1);
18330 
18331  /**
18332  * \brief Setter for member variable \ref UnitDef.unit1
18333  */
18334  void set_unit1(const std::shared_ptr<Unit> &unit1);
18335 
18336  /**
18337  * \brief Setter for member variable \ref UnitDef.unit2 (rvalue reference)
18338  */
18339  void set_unit2(std::shared_ptr<Unit> &&unit2);
18340 
18341  /**
18342  * \brief Setter for member variable \ref UnitDef.unit2
18343  */
18344  void set_unit2(const std::shared_ptr<Unit> &unit2);
18345 
18346  /// \}
18347 
18348  /// \name Visitor
18349  /// \{
18350 
18351  /**
18352  * \brief visit children i.e. member variables of current node using provided
18353  * visitor
18354  *
18355  * Different nodes in the AST have different members (i.e. children). This
18356  * method recursively visits children using provided visitor.
18357  *
18358  * \param v Concrete visitor that will be used to recursively visit children
18359  *
18360  * \sa Ast::visit_children for example.
18361  */
18362  void visit_children(visitor::Visitor &v) override;
18363 
18364  /**
18365  * \brief accept (or visit) the current AST node using provided visitor
18366  *
18367  * Instead of visiting children of AST node, like Ast::visit_children,
18368  * accept allows to visit the current node itself using provided concrete
18369  * visitor.
18370  *
18371  * \param v Concrete visitor that will be used to recursively visit node
18372  *
18373  * \sa Ast::accept for example.
18374  */
18375  void accept(visitor::Visitor &v) override;
18376 
18377  /// \}
18378 
18379 private:
18380  /**
18381  * \brief Set this object as parent for all the children
18382  *
18383  * This should be called in every object (with children) constructor
18384  * to set parents. Since it is called only in the constructors it
18385  * should not be virtual to avoid ambiguities (issue #295).
18386  */
18387  void set_parent_in_children();
18388 };
18389 
18390 /** @} */ // end of ast_class
18391 
18392 } // namespace ast
18393 } // namespace nmodl
18394 #endif // !NMODL_AST_UNIT_DEF_HPP
18395 #ifndef NMODL_AST_FACTOR_DEF_HPP
18396 #define NMODL_AST_FACTOR_DEF_HPP
18397 
18398 namespace nmodl {
18399 namespace ast {
18400 
18401 /**
18402  * @addtogroup ast_class
18403  * @ingroup ast
18404  * @{
18405  */
18406 
18407 /**
18408  * \brief TODO
18409  *
18410  *
18411  */
18412 class FactorDef : public Expression {
18413 private:
18414  /// TODO
18415  std::shared_ptr<Name> name;
18416  /// TODO
18417  std::shared_ptr<Double> value;
18418  /// TODO
18419  std::shared_ptr<Unit> unit1;
18420  /// Todo: Michael : rename variable gt as well
18421  std::shared_ptr<Boolean> gt;
18422  /// TODO
18423  std::shared_ptr<Unit> unit2;
18424  /// token with location information
18425  std::shared_ptr<ModToken> token;
18426 
18427 public:
18428  /// \name Ctor & dtor
18429  /// \{
18430 
18431  explicit FactorDef(Name *name, Double *value, Unit *unit1, Boolean *gt,
18432  Unit *unit2);
18433  explicit FactorDef(const std::shared_ptr<Name> &name,
18434  const std::shared_ptr<Double> &value,
18435  const std::shared_ptr<Unit> &unit1,
18436  const std::shared_ptr<Boolean> &gt,
18437  const std::shared_ptr<Unit> &unit2);
18438  FactorDef(const FactorDef &obj);
18439 
18440  FactorDef() = default;
18441 
18442  virtual ~FactorDef() = default;
18443 
18444  /// \}
18445 
18446  /**
18447  * \brief Check if the ast node is an instance of ast::FactorDef
18448  * \return true as object is of type ast::FactorDef
18449  */
18450  bool is_factor_def() const noexcept override { return true; }
18451 
18452  /**
18453  * \brief Return a copy of the current node
18454  *
18455  * Recursively make a new copy/clone of the current node including
18456  * all members and return a pointer to the node. This is used for
18457  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18458  * ast.
18459  *
18460  * @return pointer to the clone/copy of the current node
18461  */
18462  FactorDef *clone() const override { return new FactorDef(*this); }
18463 
18464  /// \name Getters
18465  /// \{
18466 
18467  /**
18468  * \brief Return type (ast::AstNodeType) of ast node
18469  *
18470  * Every node in the ast has a type defined in ast::AstNodeType and this
18471  * function is used to retrieve the same.
18472  *
18473  * \return ast node type i.e. ast::AstNodeType::FACTOR_DEF
18474  *
18475  * \sa Ast::get_node_type_name
18476  */
18477  AstNodeType get_node_type() const noexcept override {
18478  return AstNodeType::FACTOR_DEF;
18479  }
18480 
18481  /**
18482  * \brief Return type (ast::AstNodeType) of ast node as std::string
18483  *
18484  * Every node in the ast has a type defined in ast::AstNodeType.
18485  * This type name can be returned as a std::string for printing
18486  * node to text/json form.
18487  *
18488  * \return name of the node type as a string i.e. "FactorDef"
18489  *
18490  * \sa Ast::get_node_name
18491  */
18492  std::string get_node_type_name() const noexcept override {
18493  return "FactorDef";
18494  }
18495 
18496  /**
18497  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18498  */
18499  std::shared_ptr<Ast> get_shared_ptr() override {
18500  return std::static_pointer_cast<FactorDef>(shared_from_this());
18501  }
18502 
18503  /**
18504  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18505  */
18506  std::shared_ptr<const Ast> get_shared_ptr() const override {
18507  return std::static_pointer_cast<const FactorDef>(shared_from_this());
18508  }
18509 
18510  /**
18511  * \brief Return associated token for the current ast node
18512  *
18513  * Not all ast nodes have token information. For example,
18514  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18515  * solution of ODEs. In this case, we return nullptr to store in the
18516  * nmodl::symtab::SymbolTable.
18517  *
18518  * \return pointer to token if exist otherwise nullptr
18519  */
18520  const ModToken *get_token() const noexcept override { return token.get(); }
18521 
18522  /**
18523  * \brief Return name of the node
18524  *
18525  * Some ast nodes have a member marked designated as node name. For example,
18526  * in case of this ast::Name has name designated as a
18527  * node name.
18528  *
18529  * @return name of the node as std::string
18530  *
18531  * \sa Ast::get_node_type_name
18532  */
18533  std::string get_node_name() const override;
18534 
18535  /**
18536  * \brief Getter for member variable \ref FactorDef.name
18537  */
18538  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
18539 
18540  /**
18541  * \brief Getter for member variable \ref FactorDef.value
18542  */
18543  const std::shared_ptr<Double> &get_value() const noexcept { return value; }
18544 
18545  /**
18546  * \brief Getter for member variable \ref FactorDef.unit1
18547  */
18548  const std::shared_ptr<Unit> &get_unit1() const noexcept { return unit1; }
18549 
18550  /**
18551  * \brief Getter for member variable \ref FactorDef.gt
18552  */
18553  const std::shared_ptr<Boolean> &get_gt() const noexcept { return gt; }
18554 
18555  /**
18556  * \brief Getter for member variable \ref FactorDef.unit2
18557  */
18558  const std::shared_ptr<Unit> &get_unit2() const noexcept { return unit2; }
18559 
18560  /// \}
18561 
18562  /// \name Setters
18563  /// \{
18564 
18565  /**
18566  * \brief Set token for the current ast node
18567  */
18568  void set_token(const ModToken &tok) {
18569  token = std::make_shared<ModToken>(tok);
18570  }
18571 
18572  /**
18573  * \brief Setter for member variable \ref FactorDef.name (rvalue reference)
18574  */
18575  void set_name(std::shared_ptr<Name> &&name);
18576 
18577  /**
18578  * \brief Setter for member variable \ref FactorDef.name
18579  */
18580  void set_name(const std::shared_ptr<Name> &name);
18581 
18582  /**
18583  * \brief Setter for member variable \ref FactorDef.value (rvalue reference)
18584  */
18585  void set_value(std::shared_ptr<Double> &&value);
18586 
18587  /**
18588  * \brief Setter for member variable \ref FactorDef.value
18589  */
18590  void set_value(const std::shared_ptr<Double> &value);
18591 
18592  /**
18593  * \brief Setter for member variable \ref FactorDef.unit1 (rvalue reference)
18594  */
18595  void set_unit1(std::shared_ptr<Unit> &&unit1);
18596 
18597  /**
18598  * \brief Setter for member variable \ref FactorDef.unit1
18599  */
18600  void set_unit1(const std::shared_ptr<Unit> &unit1);
18601 
18602  /**
18603  * \brief Setter for member variable \ref FactorDef.gt (rvalue reference)
18604  */
18605  void set_gt(std::shared_ptr<Boolean> &&gt);
18606 
18607  /**
18608  * \brief Setter for member variable \ref FactorDef.gt
18609  */
18610  void set_gt(const std::shared_ptr<Boolean> &gt);
18611 
18612  /**
18613  * \brief Setter for member variable \ref FactorDef.unit2 (rvalue reference)
18614  */
18615  void set_unit2(std::shared_ptr<Unit> &&unit2);
18616 
18617  /**
18618  * \brief Setter for member variable \ref FactorDef.unit2
18619  */
18620  void set_unit2(const std::shared_ptr<Unit> &unit2);
18621 
18622  /// \}
18623 
18624  /// \name Visitor
18625  /// \{
18626 
18627  /**
18628  * \brief visit children i.e. member variables of current node using provided
18629  * visitor
18630  *
18631  * Different nodes in the AST have different members (i.e. children). This
18632  * method recursively visits children using provided visitor.
18633  *
18634  * \param v Concrete visitor that will be used to recursively visit children
18635  *
18636  * \sa Ast::visit_children for example.
18637  */
18638  void visit_children(visitor::Visitor &v) override;
18639 
18640  /**
18641  * \brief accept (or visit) the current AST node using provided visitor
18642  *
18643  * Instead of visiting children of AST node, like Ast::visit_children,
18644  * accept allows to visit the current node itself using provided concrete
18645  * visitor.
18646  *
18647  * \param v Concrete visitor that will be used to recursively visit node
18648  *
18649  * \sa Ast::accept for example.
18650  */
18651  void accept(visitor::Visitor &v) override;
18652 
18653  /// \}
18654 
18655 private:
18656  /**
18657  * \brief Set this object as parent for all the children
18658  *
18659  * This should be called in every object (with children) constructor
18660  * to set parents. Since it is called only in the constructors it
18661  * should not be virtual to avoid ambiguities (issue #295).
18662  */
18663  void set_parent_in_children();
18664 };
18665 
18666 /** @} */ // end of ast_class
18667 
18668 } // namespace ast
18669 } // namespace nmodl
18670 #endif // !NMODL_AST_FACTOR_DEF_HPP
18671 #ifndef NMODL_AST_VALENCE_HPP
18672 #define NMODL_AST_VALENCE_HPP
18673 
18674 namespace nmodl {
18675 namespace ast {
18676 
18677 /**
18678  * @addtogroup ast_class
18679  * @ingroup ast
18680  * @{
18681  */
18682 
18683 /**
18684  * \brief TODO
18685  *
18686  *
18687  */
18688 class Valence : public Expression {
18689 private:
18690  /// TODO
18691  std::shared_ptr<Name> type;
18692  /// TODO
18693  std::shared_ptr<Double> value;
18694  /// token with location information
18695  std::shared_ptr<ModToken> token;
18696 
18697 public:
18698  /// \name Ctor & dtor
18699  /// \{
18700 
18701  explicit Valence(Name *type, Double *value);
18702  explicit Valence(const std::shared_ptr<Name> &type,
18703  const std::shared_ptr<Double> &value);
18704  Valence(const Valence &obj);
18705 
18706  virtual ~Valence() = default;
18707 
18708  /// \}
18709 
18710  /**
18711  * \brief Check if the ast node is an instance of ast::Valence
18712  * \return true as object is of type ast::Valence
18713  */
18714  bool is_valence() const noexcept override { return true; }
18715 
18716  /**
18717  * \brief Return a copy of the current node
18718  *
18719  * Recursively make a new copy/clone of the current node including
18720  * all members and return a pointer to the node. This is used for
18721  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18722  * ast.
18723  *
18724  * @return pointer to the clone/copy of the current node
18725  */
18726  Valence *clone() const override { return new Valence(*this); }
18727 
18728  /// \name Getters
18729  /// \{
18730 
18731  /**
18732  * \brief Return type (ast::AstNodeType) of ast node
18733  *
18734  * Every node in the ast has a type defined in ast::AstNodeType and this
18735  * function is used to retrieve the same.
18736  *
18737  * \return ast node type i.e. ast::AstNodeType::VALENCE
18738  *
18739  * \sa Ast::get_node_type_name
18740  */
18741  AstNodeType get_node_type() const noexcept override {
18742  return AstNodeType::VALENCE;
18743  }
18744 
18745  /**
18746  * \brief Return type (ast::AstNodeType) of ast node as std::string
18747  *
18748  * Every node in the ast has a type defined in ast::AstNodeType.
18749  * This type name can be returned as a std::string for printing
18750  * node to text/json form.
18751  *
18752  * \return name of the node type as a string i.e. "Valence"
18753  *
18754  * \sa Ast::get_node_name
18755  */
18756  std::string get_node_type_name() const noexcept override { return "Valence"; }
18757 
18758  /**
18759  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18760  */
18761  std::shared_ptr<Ast> get_shared_ptr() override {
18762  return std::static_pointer_cast<Valence>(shared_from_this());
18763  }
18764 
18765  /**
18766  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18767  */
18768  std::shared_ptr<const Ast> get_shared_ptr() const override {
18769  return std::static_pointer_cast<const Valence>(shared_from_this());
18770  }
18771 
18772  /**
18773  * \brief Return associated token for the current ast node
18774  *
18775  * Not all ast nodes have token information. For example,
18776  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18777  * solution of ODEs. In this case, we return nullptr to store in the
18778  * nmodl::symtab::SymbolTable.
18779  *
18780  * \return pointer to token if exist otherwise nullptr
18781  */
18782  const ModToken *get_token() const noexcept override { return token.get(); }
18783 
18784  /**
18785  * \brief Getter for member variable \ref Valence.type
18786  */
18787  const std::shared_ptr<Name> &get_type() const noexcept { return type; }
18788 
18789  /**
18790  * \brief Getter for member variable \ref Valence.value
18791  */
18792  const std::shared_ptr<Double> &get_value() const noexcept { return value; }
18793 
18794  /// \}
18795 
18796  /// \name Setters
18797  /// \{
18798 
18799  /**
18800  * \brief Set token for the current ast node
18801  */
18802  void set_token(const ModToken &tok) {
18803  token = std::make_shared<ModToken>(tok);
18804  }
18805 
18806  /**
18807  * \brief Setter for member variable \ref Valence.type (rvalue reference)
18808  */
18809  void set_type(std::shared_ptr<Name> &&type);
18810 
18811  /**
18812  * \brief Setter for member variable \ref Valence.type
18813  */
18814  void set_type(const std::shared_ptr<Name> &type);
18815 
18816  /**
18817  * \brief Setter for member variable \ref Valence.value (rvalue reference)
18818  */
18819  void set_value(std::shared_ptr<Double> &&value);
18820 
18821  /**
18822  * \brief Setter for member variable \ref Valence.value
18823  */
18824  void set_value(const std::shared_ptr<Double> &value);
18825 
18826  /// \}
18827 
18828  /// \name Visitor
18829  /// \{
18830 
18831  /**
18832  * \brief visit children i.e. member variables of current node using provided
18833  * visitor
18834  *
18835  * Different nodes in the AST have different members (i.e. children). This
18836  * method recursively visits children using provided visitor.
18837  *
18838  * \param v Concrete visitor that will be used to recursively visit children
18839  *
18840  * \sa Ast::visit_children for example.
18841  */
18842  void visit_children(visitor::Visitor &v) override;
18843 
18844  /**
18845  * \brief accept (or visit) the current AST node using provided visitor
18846  *
18847  * Instead of visiting children of AST node, like Ast::visit_children,
18848  * accept allows to visit the current node itself using provided concrete
18849  * visitor.
18850  *
18851  * \param v Concrete visitor that will be used to recursively visit node
18852  *
18853  * \sa Ast::accept for example.
18854  */
18855  void accept(visitor::Visitor &v) override;
18856 
18857  /// \}
18858 
18859 private:
18860  /**
18861  * \brief Set this object as parent for all the children
18862  *
18863  * This should be called in every object (with children) constructor
18864  * to set parents. Since it is called only in the constructors it
18865  * should not be virtual to avoid ambiguities (issue #295).
18866  */
18867  void set_parent_in_children();
18868 };
18869 
18870 /** @} */ // end of ast_class
18871 
18872 } // namespace ast
18873 } // namespace nmodl
18874 #endif // !NMODL_AST_VALENCE_HPP
18875 #ifndef NMODL_AST_UNIT_STATE_HPP
18876 #define NMODL_AST_UNIT_STATE_HPP
18877 
18878 namespace nmodl {
18879 namespace ast {
18880 
18881 /**
18882  * @addtogroup ast_class
18883  * @ingroup ast
18884  * @{
18885  */
18886 
18887 /**
18888  * \brief TODO
18889  *
18890  *
18891  */
18892 class UnitState : public Statement {
18893 private:
18894  /// TODO
18896  /// token with location information
18897  std::shared_ptr<ModToken> token;
18898 
18899 public:
18900  /// \name Ctor & dtor
18901  /// \{
18902 
18903  explicit UnitState(UnitStateType value);
18904  UnitState(const UnitState &obj);
18905 
18906  virtual ~UnitState() = default;
18907 
18908  /// \}
18909 
18910  /**
18911  * \brief Check if the ast node is an instance of ast::UnitState
18912  * \return true as object is of type ast::UnitState
18913  */
18914  bool is_unit_state() const noexcept override { return true; }
18915 
18916  /**
18917  * \brief Return a copy of the current node
18918  *
18919  * Recursively make a new copy/clone of the current node including
18920  * all members and return a pointer to the node. This is used for
18921  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18922  * ast.
18923  *
18924  * @return pointer to the clone/copy of the current node
18925  */
18926  UnitState *clone() const override { return new UnitState(*this); }
18927 
18928  /// \name Getters
18929  /// \{
18930 
18931  /**
18932  * \brief Return type (ast::AstNodeType) of ast node
18933  *
18934  * Every node in the ast has a type defined in ast::AstNodeType and this
18935  * function is used to retrieve the same.
18936  *
18937  * \return ast node type i.e. ast::AstNodeType::UNIT_STATE
18938  *
18939  * \sa Ast::get_node_type_name
18940  */
18941  AstNodeType get_node_type() const noexcept override {
18942  return AstNodeType::UNIT_STATE;
18943  }
18944 
18945  /**
18946  * \brief Return type (ast::AstNodeType) of ast node as std::string
18947  *
18948  * Every node in the ast has a type defined in ast::AstNodeType.
18949  * This type name can be returned as a std::string for printing
18950  * node to text/json form.
18951  *
18952  * \return name of the node type as a string i.e. "UnitState"
18953  *
18954  * \sa Ast::get_node_name
18955  */
18956  std::string get_node_type_name() const noexcept override {
18957  return "UnitState";
18958  }
18959 
18960  /**
18961  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18962  */
18963  std::shared_ptr<Ast> get_shared_ptr() override {
18964  return std::static_pointer_cast<UnitState>(shared_from_this());
18965  }
18966 
18967  /**
18968  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18969  */
18970  std::shared_ptr<const Ast> get_shared_ptr() const override {
18971  return std::static_pointer_cast<const UnitState>(shared_from_this());
18972  }
18973 
18974  /**
18975  * \brief Return associated token for the current ast node
18976  *
18977  * Not all ast nodes have token information. For example,
18978  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18979  * solution of ODEs. In this case, we return nullptr to store in the
18980  * nmodl::symtab::SymbolTable.
18981  *
18982  * \return pointer to token if exist otherwise nullptr
18983  */
18984  const ModToken *get_token() const noexcept override { return token.get(); }
18985 
18986  /**
18987  * \brief Getter for member variable \ref UnitState.value
18988  */
18989  UnitStateType get_value() const noexcept { return value; }
18990 
18991  /// \}
18992 
18993  /// \name Setters
18994  /// \{
18995 
18996  /**
18997  * \brief Set token for the current ast node
18998  */
18999  void set_token(const ModToken &tok) {
19000  token = std::make_shared<ModToken>(tok);
19001  }
19002 
19003  /**
19004  * \brief Setter for member variable \ref UnitState.value
19005  */
19006  void set_value(UnitStateType value);
19007 
19008  /// \}
19009 
19010  /// \name Visitor
19011  /// \{
19012 
19013  /**
19014  * \brief visit children i.e. member variables of current node using provided
19015  * visitor
19016  *
19017  * Different nodes in the AST have different members (i.e. children). This
19018  * method recursively visits children using provided visitor.
19019  *
19020  * \param v Concrete visitor that will be used to recursively visit children
19021  *
19022  * \sa Ast::visit_children for example.
19023  */
19024  void visit_children(visitor::Visitor &v) override;
19025 
19026  /**
19027  * \brief accept (or visit) the current AST node using provided visitor
19028  *
19029  * Instead of visiting children of AST node, like Ast::visit_children,
19030  * accept allows to visit the current node itself using provided concrete
19031  * visitor.
19032  *
19033  * \param v Concrete visitor that will be used to recursively visit node
19034  *
19035  * \sa Ast::accept for example.
19036  */
19037  void accept(visitor::Visitor &v) override;
19038 
19039  /// \}
19040 
19041  /**
19042  * \brief Return enum value in string form
19043  *
19044  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
19045  * string representation when they are converted from AST back to
19046  * NMODL. This method is used to return corresponding string representation.
19047  */
19048  std::string eval() const { return UnitStateTypeNames[value]; }
19049 
19050 private:
19051  /**
19052  * \brief Set this object as parent for all the children
19053  *
19054  * This should be called in every object (with children) constructor
19055  * to set parents. Since it is called only in the constructors it
19056  * should not be virtual to avoid ambiguities (issue #295).
19057  */
19058  void set_parent_in_children();
19059 };
19060 
19061 /** @} */ // end of ast_class
19062 
19063 } // namespace ast
19064 } // namespace nmodl
19065 #endif // !NMODL_AST_UNIT_STATE_HPP
19066 #ifndef NMODL_AST_LOCAL_LIST_STATEMENT_HPP
19067 #define NMODL_AST_LOCAL_LIST_STATEMENT_HPP
19068 
19069 namespace nmodl {
19070 namespace ast {
19071 
19072 /**
19073  * @addtogroup ast_class
19074  * @ingroup ast
19075  * @{
19076  */
19077 
19078 /**
19079  * \brief TODO
19080  *
19081  *
19082  */
19084 private:
19085  /// TODO
19087  /// token with location information
19088  std::shared_ptr<ModToken> token;
19089 
19090 public:
19091  /// \name Ctor & dtor
19092  /// \{
19093 
19094  explicit LocalListStatement(LocalVarVector variables);
19096 
19097  virtual ~LocalListStatement() = default;
19098 
19099  /// \}
19100 
19101  /**
19102  * \brief Check if the ast node is an instance of ast::LocalListStatement
19103  * \return true as object is of type ast::LocalListStatement
19104  */
19105  bool is_local_list_statement() const noexcept override { return true; }
19106 
19107  /**
19108  * \brief Return a copy of the current node
19109  *
19110  * Recursively make a new copy/clone of the current node including
19111  * all members and return a pointer to the node. This is used for
19112  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19113  * ast.
19114  *
19115  * @return pointer to the clone/copy of the current node
19116  */
19117  LocalListStatement *clone() const override {
19118  return new LocalListStatement(*this);
19119  }
19120 
19121  /// \name Getters
19122  /// \{
19123 
19124  /**
19125  * \brief Return type (ast::AstNodeType) of ast node
19126  *
19127  * Every node in the ast has a type defined in ast::AstNodeType and this
19128  * function is used to retrieve the same.
19129  *
19130  * \return ast node type i.e. ast::AstNodeType::LOCAL_LIST_STATEMENT
19131  *
19132  * \sa Ast::get_node_type_name
19133  */
19134  AstNodeType get_node_type() const noexcept override {
19136  }
19137 
19138  /**
19139  * \brief Return type (ast::AstNodeType) of ast node as std::string
19140  *
19141  * Every node in the ast has a type defined in ast::AstNodeType.
19142  * This type name can be returned as a std::string for printing
19143  * node to text/json form.
19144  *
19145  * \return name of the node type as a string i.e. "LocalListStatement"
19146  *
19147  * \sa Ast::get_node_name
19148  */
19149  std::string get_node_type_name() const noexcept override {
19150  return "LocalListStatement";
19151  }
19152 
19153  /**
19154  * \brief Return NMODL statement of ast node as std::string
19155  *
19156  * Every node is related to a special statement in the NMODL. This
19157  * statement can be returned as a std::string for printing to
19158  * text/json form.
19159  *
19160  * \return name of the statement as a string i.e. "LOCAL "
19161  *
19162  * \sa Ast::get_nmodl_name
19163  */
19164  std::string get_nmodl_name() const noexcept override { return "LOCAL "; }
19165 
19166  /**
19167  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19168  */
19169  std::shared_ptr<Ast> get_shared_ptr() override {
19170  return std::static_pointer_cast<LocalListStatement>(shared_from_this());
19171  }
19172 
19173  /**
19174  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19175  */
19176  std::shared_ptr<const Ast> get_shared_ptr() const override {
19177  return std::static_pointer_cast<const LocalListStatement>(
19178  shared_from_this());
19179  }
19180 
19181  /**
19182  * \brief Return associated token for the current ast node
19183  *
19184  * Not all ast nodes have token information. For example,
19185  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
19186  * solution of ODEs. In this case, we return nullptr to store in the
19187  * nmodl::symtab::SymbolTable.
19188  *
19189  * \return pointer to token if exist otherwise nullptr
19190  */
19191  const ModToken *get_token() const noexcept override { return token.get(); }
19192 
19193  /**
19194  * \brief Add member to variables by raw pointer
19195  */
19197  variables.emplace_back(n);
19198 
19199  // set parents
19200  n->set_parent(this);
19201  }
19202 
19203  /**
19204  * \brief Add member to variables by shared_ptr
19205  */
19206  void emplace_back_local_var(std::shared_ptr<LocalVar> n) {
19207  variables.emplace_back(n);
19208  // set parents
19209  n->set_parent(this);
19210  }
19211 
19212  /**
19213  * \brief Erase member to variables
19214  */
19215  LocalVarVector::const_iterator
19216  erase_local_var(LocalVarVector::const_iterator first) {
19217  auto first_it = const_iter_cast(variables, first);
19218  return variables.erase(first_it);
19219  }
19220  /**
19221  * \brief Erase members to variables
19222  */
19223  LocalVarVector::const_iterator
19224  erase_local_var(LocalVarVector::const_iterator first,
19225  LocalVarVector::const_iterator last) {
19226  auto first_it = const_iter_cast(variables, first);
19227  auto last_it = const_iter_cast(variables, last);
19228  return variables.erase(first_it, last_it);
19229  }
19230  /**
19231  * \brief Erase non-consecutive members to variables
19232  *
19233  * loosely following the cpp reference of remove_if
19234  */
19235  size_t erase_local_var(std::unordered_set<LocalVar *> &to_be_erased) {
19236  auto first = variables.begin();
19237  auto last = variables.end();
19238  auto result = first;
19239 
19240  while (first != last) {
19241  // automatically erase dangling pointers from the uset while
19242  // looking for them to erase them in the vector
19243  if (to_be_erased.erase(first->get()) == 0) {
19244  reset_local_var(result, *first);
19245  ++result;
19246  }
19247  ++first;
19248  }
19249 
19250  size_t out = last - result;
19251  erase_local_var(result, last);
19252 
19253  return out;
19254  }
19255 
19256  /**
19257  * \brief Insert member to variables
19258  */
19259  LocalVarVector::const_iterator
19260  insert_local_var(LocalVarVector::const_iterator position,
19261  const std::shared_ptr<LocalVar> &n) {
19262  n->set_parent(this);
19263  auto pos_it = const_iter_cast(variables, position);
19264  return variables.insert(pos_it, n);
19265  }
19266  /**
19267  * \brief Insert members to variables
19268  */
19269  template <class NodeType, class InputIterator>
19270  void insert_local_var(LocalVarVector::const_iterator position, NodeType &to,
19271  InputIterator first, InputIterator last) {
19272 
19273  for (auto it = first; it != last; ++it) {
19274  auto &n = *it;
19275  // set parents
19276  n->set_parent(this);
19277  }
19278  auto pos_it = const_iter_cast(variables, position);
19279  auto first_it = const_iter_cast(to, first);
19280  auto last_it = const_iter_cast(to, last);
19281  variables.insert(pos_it, first_it, last_it);
19282  }
19283 
19284  /**
19285  * \brief Reset member to variables
19286  */
19287  void reset_local_var(LocalVarVector::const_iterator position, LocalVar *n) {
19288  // set parents
19289  n->set_parent(this);
19290 
19291  variables[position - variables.begin()].reset(n);
19292  }
19293 
19294  /**
19295  * \brief Reset member to variables
19296  */
19297  void reset_local_var(LocalVarVector::const_iterator position,
19298  std::shared_ptr<LocalVar> n) {
19299  // set parents
19300  n->set_parent(this);
19301 
19302  variables[position - variables.begin()] = n;
19303  }
19304 
19305  /**
19306  * \brief Getter for member variable \ref LocalListStatement.variables
19307  */
19308  const LocalVarVector &get_variables() const noexcept { return variables; }
19309 
19310  /// \}
19311 
19312  /// \name Setters
19313  /// \{
19314 
19315  /**
19316  * \brief Set token for the current ast node
19317  */
19318  void set_token(const ModToken &tok) {
19319  token = std::make_shared<ModToken>(tok);
19320  }
19321 
19322  /**
19323  * \brief Setter for member variable \ref LocalListStatement.variables (rvalue
19324  * reference)
19325  */
19326  void set_variables(LocalVarVector &&variables);
19327 
19328  /**
19329  * \brief Setter for member variable \ref LocalListStatement.variables
19330  */
19331  void set_variables(const LocalVarVector &variables);
19332 
19333  /// \}
19334 
19335  /// \name Visitor
19336  /// \{
19337 
19338  /**
19339  * \brief visit children i.e. member variables of current node using provided
19340  * visitor
19341  *
19342  * Different nodes in the AST have different members (i.e. children). This
19343  * method recursively visits children using provided visitor.
19344  *
19345  * \param v Concrete visitor that will be used to recursively visit children
19346  *
19347  * \sa Ast::visit_children for example.
19348  */
19349  void visit_children(visitor::Visitor &v) override;
19350 
19351  /**
19352  * \brief accept (or visit) the current AST node using provided visitor
19353  *
19354  * Instead of visiting children of AST node, like Ast::visit_children,
19355  * accept allows to visit the current node itself using provided concrete
19356  * visitor.
19357  *
19358  * \param v Concrete visitor that will be used to recursively visit node
19359  *
19360  * \sa Ast::accept for example.
19361  */
19362  void accept(visitor::Visitor &v) override;
19363 
19364  /// \}
19365 
19366 private:
19367  /**
19368  * \brief Set this object as parent for all the children
19369  *
19370  * This should be called in every object (with children) constructor
19371  * to set parents. Since it is called only in the constructors it
19372  * should not be virtual to avoid ambiguities (issue #295).
19373  */
19374  void set_parent_in_children();
19375 };
19376 
19377 /** @} */ // end of ast_class
19378 
19379 } // namespace ast
19380 } // namespace nmodl
19381 #endif // !NMODL_AST_LOCAL_LIST_STATEMENT_HPP
19382 #ifndef NMODL_AST_MODEL_HPP
19383 #define NMODL_AST_MODEL_HPP
19384 
19385 namespace nmodl {
19386 namespace ast {
19387 
19388 /**
19389  * @addtogroup ast_class
19390  * @ingroup ast
19391  * @{
19392  */
19393 
19394 /**
19395  * \brief TODO
19396  *
19397  *
19398  */
19399 class Model : public Statement {
19400 private:
19401  /// TODO
19402  std::shared_ptr<String> title;
19403  /// token with location information
19404  std::shared_ptr<ModToken> token;
19405 
19406 public:
19407  /// \name Ctor & dtor
19408  /// \{
19409 
19410  explicit Model(String *title);
19411  explicit Model(const std::shared_ptr<String> &title);
19412  Model(const Model &obj);
19413 
19414  virtual ~Model() = default;
19415 
19416  /// \}
19417 
19418  /**
19419  * \brief Check if the ast node is an instance of ast::Model
19420  * \return true as object is of type ast::Model
19421  */
19422  bool is_model() const noexcept override { return true; }
19423 
19424  /**
19425  * \brief Return a copy of the current node
19426  *
19427  * Recursively make a new copy/clone of the current node including
19428  * all members and return a pointer to the node. This is used for
19429  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19430  * ast.
19431  *
19432  * @return pointer to the clone/copy of the current node
19433  */
19434  Model *clone() const override { return new Model(*this); }
19435 
19436  /// \name Getters
19437  /// \{
19438 
19439  /**
19440  * \brief Return type (ast::AstNodeType) of ast node
19441  *
19442  * Every node in the ast has a type defined in ast::AstNodeType and this
19443  * function is used to retrieve the same.
19444  *
19445  * \return ast node type i.e. ast::AstNodeType::MODEL
19446  *
19447  * \sa Ast::get_node_type_name
19448  */
19449  AstNodeType get_node_type() const noexcept override {
19450  return AstNodeType::MODEL;
19451  }
19452 
19453  /**
19454  * \brief Return type (ast::AstNodeType) of ast node as std::string
19455  *
19456  * Every node in the ast has a type defined in ast::AstNodeType.
19457  * This type name can be returned as a std::string for printing
19458  * node to text/json form.
19459  *
19460  * \return name of the node type as a string i.e. "Model"
19461  *
19462  * \sa Ast::get_node_name
19463  */
19464  std::string get_node_type_name() const noexcept override { return "Model"; }
19465 
19466  /**
19467  * \brief Return NMODL statement of ast node as std::string
19468  *
19469  * Every node is related to a special statement in the NMODL. This
19470  * statement can be returned as a std::string for printing to
19471  * text/json form.
19472  *
19473  * \return name of the statement as a string i.e. "TITLE"
19474  *
19475  * \sa Ast::get_nmodl_name
19476  */
19477  std::string get_nmodl_name() const noexcept override { return "TITLE"; }
19478 
19479  /**
19480  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19481  */
19482  std::shared_ptr<Ast> get_shared_ptr() override {
19483  return std::static_pointer_cast<Model>(shared_from_this());
19484  }
19485 
19486  /**
19487  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19488  */
19489  std::shared_ptr<const Ast> get_shared_ptr() const override {
19490  return std::static_pointer_cast<const Model>(shared_from_this());
19491  }
19492 
19493  /**
19494  * \brief Return associated token for the current ast node
19495  *
19496  * Not all ast nodes have token information. For example,
19497  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
19498  * solution of ODEs. In this case, we return nullptr to store in the
19499  * nmodl::symtab::SymbolTable.
19500  *
19501  * \return pointer to token if exist otherwise nullptr
19502  */
19503  const ModToken *get_token() const noexcept override { return token.get(); }
19504 
19505  /**
19506  * \brief Getter for member variable \ref Model.title
19507  */
19508  const std::shared_ptr<String> &get_title() const noexcept { return title; }
19509 
19510  /// \}
19511 
19512  /// \name Setters
19513  /// \{
19514 
19515  /**
19516  * \brief Set token for the current ast node
19517  */
19518  void set_token(const ModToken &tok) {
19519  token = std::make_shared<ModToken>(tok);
19520  }
19521 
19522  /**
19523  * \brief Setter for member variable \ref Model.title (rvalue reference)
19524  */
19525  void set_title(std::shared_ptr<String> &&title);
19526 
19527  /**
19528  * \brief Setter for member variable \ref Model.title
19529  */
19530  void set_title(const std::shared_ptr<String> &title);
19531 
19532  /// \}
19533 
19534  /// \name Visitor
19535  /// \{
19536 
19537  /**
19538  * \brief visit children i.e. member variables of current node using provided
19539  * visitor
19540  *
19541  * Different nodes in the AST have different members (i.e. children). This
19542  * method recursively visits children using provided visitor.
19543  *
19544  * \param v Concrete visitor that will be used to recursively visit children
19545  *
19546  * \sa Ast::visit_children for example.
19547  */
19548  void visit_children(visitor::Visitor &v) override;
19549 
19550  /**
19551  * \brief accept (or visit) the current AST node using provided visitor
19552  *
19553  * Instead of visiting children of AST node, like Ast::visit_children,
19554  * accept allows to visit the current node itself using provided concrete
19555  * visitor.
19556  *
19557  * \param v Concrete visitor that will be used to recursively visit node
19558  *
19559  * \sa Ast::accept for example.
19560  */
19561  void accept(visitor::Visitor &v) override;
19562 
19563  /// \}
19564 
19565 private:
19566  /**
19567  * \brief Set this object as parent for all the children
19568  *
19569  * This should be called in every object (with children) constructor
19570  * to set parents. Since it is called only in the constructors it
19571  * should not be virtual to avoid ambiguities (issue #295).
19572  */
19573  void set_parent_in_children();
19574 };
19575 
19576 /** @} */ // end of ast_class
19577 
19578 } // namespace ast
19579 } // namespace nmodl
19580 #endif // !NMODL_AST_MODEL_HPP
19581 #ifndef NMODL_AST_DEFINE_HPP
19582 #define NMODL_AST_DEFINE_HPP
19583 
19584 namespace nmodl {
19585 namespace ast {
19586 
19587 /**
19588  * @addtogroup ast_class
19589  * @ingroup ast
19590  * @{
19591  */
19592 
19593 /**
19594  * \brief Represents a `DEFINE` statement in NMODL
19595  *
19596  *
19597  */
19598 class Define : public Statement {
19599 private:
19600  /// Name of the macro
19601  std::shared_ptr<Name> name;
19602  /// Value of the macro
19603  std::shared_ptr<Integer> value;
19604  /// token with location information
19605  std::shared_ptr<ModToken> token;
19606 
19607 public:
19608  /// \name Ctor & dtor
19609  /// \{
19610 
19611  explicit Define(Name *name, Integer *value);
19612  explicit Define(const std::shared_ptr<Name> &name,
19613  const std::shared_ptr<Integer> &value);
19614  Define(const Define &obj);
19615 
19616  virtual ~Define() = default;
19617 
19618  /// \}
19619 
19620  /**
19621  * \brief Check if the ast node is an instance of ast::Define
19622  * \return true as object is of type ast::Define
19623  */
19624  bool is_define() const noexcept override { return true; }
19625 
19626  /**
19627  * \brief Return a copy of the current node
19628  *
19629  * Recursively make a new copy/clone of the current node including
19630  * all members and return a pointer to the node. This is used for
19631  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19632  * ast.
19633  *
19634  * @return pointer to the clone/copy of the current node
19635  */
19636  Define *clone() const override { return new Define(*this); }
19637 
19638  /// \name Getters
19639  /// \{
19640 
19641  /**
19642  * \brief Return type (ast::AstNodeType) of ast node
19643  *
19644  * Every node in the ast has a type defined in ast::AstNodeType and this
19645  * function is used to retrieve the same.
19646  *
19647  * \return ast node type i.e. ast::AstNodeType::DEFINE
19648  *
19649  * \sa Ast::get_node_type_name
19650  */
19651  AstNodeType get_node_type() const noexcept override {
19652  return AstNodeType::DEFINE;
19653  }
19654 
19655  /**
19656  * \brief Return type (ast::AstNodeType) of ast node as std::string
19657  *
19658  * Every node in the ast has a type defined in ast::AstNodeType.
19659  * This type name can be returned as a std::string for printing
19660  * node to text/json form.
19661  *
19662  * \return name of the node type as a string i.e. "Define"
19663  *
19664  * \sa Ast::get_node_name
19665  */
19666  std::string get_node_type_name() const noexcept override { return "Define"; }
19667 
19668  /**
19669  * \brief Return NMODL statement of ast node as std::string
19670  *
19671  * Every node is related to a special statement in the NMODL. This
19672  * statement can be returned as a std::string for printing to
19673  * text/json form.
19674  *
19675  * \return name of the statement as a string i.e. "DEFINE "
19676  *
19677  * \sa Ast::get_nmodl_name
19678  */
19679  std::string get_nmodl_name() const noexcept override { return "DEFINE "; }
19680 
19681  /**
19682  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19683  */
19684  std::shared_ptr<Ast> get_shared_ptr() override {
19685  return std::static_pointer_cast<Define>(shared_from_this());
19686  }
19687 
19688  /**
19689  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19690  */
19691  std::shared_ptr<const Ast> get_shared_ptr() const override {
19692  return std::static_pointer_cast<const Define>(shared_from_this());
19693  }
19694 
19695  /**
19696  * \brief Return associated token for the current ast node
19697  *
19698  * Not all ast nodes have token information. For example,
19699  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
19700  * solution of ODEs. In this case, we return nullptr to store in the
19701  * nmodl::symtab::SymbolTable.
19702  *
19703  * \return pointer to token if exist otherwise nullptr
19704  */
19705  const ModToken *get_token() const noexcept override { return token.get(); }
19706 
19707  /**
19708  * \brief Return name of the node
19709  *
19710  * Some ast nodes have a member marked designated as node name. For example,
19711  * in case of this ast::Name has name designated as a
19712  * node name.
19713  *
19714  * @return name of the node as std::string
19715  *
19716  * \sa Ast::get_node_type_name
19717  */
19718  std::string get_node_name() const override;
19719 
19720  /**
19721  * \brief Getter for member variable \ref Define.name
19722  */
19723  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
19724 
19725  /**
19726  * \brief Getter for member variable \ref Define.value
19727  */
19728  const std::shared_ptr<Integer> &get_value() const noexcept { return value; }
19729 
19730  /// \}
19731 
19732  /// \name Setters
19733  /// \{
19734 
19735  /**
19736  * \brief Set token for the current ast node
19737  */
19738  void set_token(const ModToken &tok) {
19739  token = std::make_shared<ModToken>(tok);
19740  }
19741 
19742  /**
19743  * \brief Setter for member variable \ref Define.name (rvalue reference)
19744  */
19745  void set_name(std::shared_ptr<Name> &&name);
19746 
19747  /**
19748  * \brief Setter for member variable \ref Define.name
19749  */
19750  void set_name(const std::shared_ptr<Name> &name);
19751 
19752  /**
19753  * \brief Setter for member variable \ref Define.value (rvalue reference)
19754  */
19755  void set_value(std::shared_ptr<Integer> &&value);
19756 
19757  /**
19758  * \brief Setter for member variable \ref Define.value
19759  */
19760  void set_value(const std::shared_ptr<Integer> &value);
19761 
19762  /// \}
19763 
19764  /// \name Visitor
19765  /// \{
19766 
19767  /**
19768  * \brief visit children i.e. member variables of current node using provided
19769  * visitor
19770  *
19771  * Different nodes in the AST have different members (i.e. children). This
19772  * method recursively visits children using provided visitor.
19773  *
19774  * \param v Concrete visitor that will be used to recursively visit children
19775  *
19776  * \sa Ast::visit_children for example.
19777  */
19778  void visit_children(visitor::Visitor &v) override;
19779 
19780  /**
19781  * \brief accept (or visit) the current AST node using provided visitor
19782  *
19783  * Instead of visiting children of AST node, like Ast::visit_children,
19784  * accept allows to visit the current node itself using provided concrete
19785  * visitor.
19786  *
19787  * \param v Concrete visitor that will be used to recursively visit node
19788  *
19789  * \sa Ast::accept for example.
19790  */
19791  void accept(visitor::Visitor &v) override;
19792 
19793  /// \}
19794 
19795 private:
19796  /**
19797  * \brief Set this object as parent for all the children
19798  *
19799  * This should be called in every object (with children) constructor
19800  * to set parents. Since it is called only in the constructors it
19801  * should not be virtual to avoid ambiguities (issue #295).
19802  */
19803  void set_parent_in_children();
19804 };
19805 
19806 /** @} */ // end of ast_class
19807 
19808 } // namespace ast
19809 } // namespace nmodl
19810 #endif // !NMODL_AST_DEFINE_HPP
19811 #ifndef NMODL_AST_INCLUDE_HPP
19812 #define NMODL_AST_INCLUDE_HPP
19813 
19814 namespace nmodl {
19815 namespace ast {
19816 
19817 /**
19818  * @addtogroup ast_class
19819  * @ingroup ast
19820  * @{
19821  */
19822 
19823 /**
19824  * \brief TODO
19825  *
19826  *
19827  */
19828 class Include : public Statement {
19829 private:
19830  /// TODO
19831  std::shared_ptr<String> filename;
19832  /// token with location information
19833  std::shared_ptr<ModToken> token;
19834 
19835 public:
19836  /// \name Ctor & dtor
19837  /// \{
19838 
19839  explicit Include(String *filename);
19840  explicit Include(const std::shared_ptr<String> &filename);
19841  Include(const Include &obj);
19842 
19843  virtual ~Include() = default;
19844 
19845  /// \}
19846 
19847  /**
19848  * \brief Check if the ast node is an instance of ast::Include
19849  * \return true as object is of type ast::Include
19850  */
19851  bool is_include() const noexcept override { return true; }
19852 
19853  /**
19854  * \brief Return a copy of the current node
19855  *
19856  * Recursively make a new copy/clone of the current node including
19857  * all members and return a pointer to the node. This is used for
19858  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19859  * ast.
19860  *
19861  * @return pointer to the clone/copy of the current node
19862  */
19863  Include *clone() const override { return new Include(*this); }
19864 
19865  /// \name Getters
19866  /// \{
19867 
19868  /**
19869  * \brief Return type (ast::AstNodeType) of ast node
19870  *
19871  * Every node in the ast has a type defined in ast::AstNodeType and this
19872  * function is used to retrieve the same.
19873  *
19874  * \return ast node type i.e. ast::AstNodeType::INCLUDE
19875  *
19876  * \sa Ast::get_node_type_name
19877  */
19878  AstNodeType get_node_type() const noexcept override {
19879  return AstNodeType::INCLUDE;
19880  }
19881 
19882  /**
19883  * \brief Return type (ast::AstNodeType) of ast node as std::string
19884  *
19885  * Every node in the ast has a type defined in ast::AstNodeType.
19886  * This type name can be returned as a std::string for printing
19887  * node to text/json form.
19888  *
19889  * \return name of the node type as a string i.e. "Include"
19890  *
19891  * \sa Ast::get_node_name
19892  */
19893  std::string get_node_type_name() const noexcept override { return "Include"; }
19894 
19895  /**
19896  * \brief Return NMODL statement of ast node as std::string
19897  *
19898  * Every node is related to a special statement in the NMODL. This
19899  * statement can be returned as a std::string for printing to
19900  * text/json form.
19901  *
19902  * \return name of the statement as a string i.e. "INCLUDE "
19903  *
19904  * \sa Ast::get_nmodl_name
19905  */
19906  std::string get_nmodl_name() const noexcept override { return "INCLUDE "; }
19907 
19908  /**
19909  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19910  */
19911  std::shared_ptr<Ast> get_shared_ptr() override {
19912  return std::static_pointer_cast<Include>(shared_from_this());
19913  }
19914 
19915  /**
19916  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19917  */
19918  std::shared_ptr<const Ast> get_shared_ptr() const override {
19919  return std::static_pointer_cast<const Include>(shared_from_this());
19920  }
19921 
19922  /**
19923  * \brief Return associated token for the current ast node
19924  *
19925  * Not all ast nodes have token information. For example,
19926  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
19927  * solution of ODEs. In this case, we return nullptr to store in the
19928  * nmodl::symtab::SymbolTable.
19929  *
19930  * \return pointer to token if exist otherwise nullptr
19931  */
19932  const ModToken *get_token() const noexcept override { return token.get(); }
19933 
19934  /**
19935  * \brief Getter for member variable \ref Include.filename
19936  */
19937  const std::shared_ptr<String> &get_filename() const noexcept {
19938  return filename;
19939  }
19940 
19941  /// \}
19942 
19943  /// \name Setters
19944  /// \{
19945 
19946  /**
19947  * \brief Set token for the current ast node
19948  */
19949  void set_token(const ModToken &tok) {
19950  token = std::make_shared<ModToken>(tok);
19951  }
19952 
19953  /**
19954  * \brief Setter for member variable \ref Include.filename (rvalue reference)
19955  */
19956  void set_filename(std::shared_ptr<String> &&filename);
19957 
19958  /**
19959  * \brief Setter for member variable \ref Include.filename
19960  */
19961  void set_filename(const std::shared_ptr<String> &filename);
19962 
19963  /// \}
19964 
19965  /// \name Visitor
19966  /// \{
19967 
19968  /**
19969  * \brief visit children i.e. member variables of current node using provided
19970  * visitor
19971  *
19972  * Different nodes in the AST have different members (i.e. children). This
19973  * method recursively visits children using provided visitor.
19974  *
19975  * \param v Concrete visitor that will be used to recursively visit children
19976  *
19977  * \sa Ast::visit_children for example.
19978  */
19979  void visit_children(visitor::Visitor &v) override;
19980 
19981  /**
19982  * \brief accept (or visit) the current AST node using provided visitor
19983  *
19984  * Instead of visiting children of AST node, like Ast::visit_children,
19985  * accept allows to visit the current node itself using provided concrete
19986  * visitor.
19987  *
19988  * \param v Concrete visitor that will be used to recursively visit node
19989  *
19990  * \sa Ast::accept for example.
19991  */
19992  void accept(visitor::Visitor &v) override;
19993 
19994  /// \}
19995 
19996 private:
19997  /**
19998  * \brief Set this object as parent for all the children
19999  *
20000  * This should be called in every object (with children) constructor
20001  * to set parents. Since it is called only in the constructors it
20002  * should not be virtual to avoid ambiguities (issue #295).
20003  */
20004  void set_parent_in_children();
20005 };
20006 
20007 /** @} */ // end of ast_class
20008 
20009 } // namespace ast
20010 } // namespace nmodl
20011 #endif // !NMODL_AST_INCLUDE_HPP
20012 #ifndef NMODL_AST_PARAM_ASSIGN_HPP
20013 #define NMODL_AST_PARAM_ASSIGN_HPP
20014 
20015 namespace nmodl {
20016 namespace ast {
20017 
20018 /**
20019  * @addtogroup ast_class
20020  * @ingroup ast
20021  * @{
20022  */
20023 
20024 /**
20025  * \brief TODO
20026  *
20027  *
20028  */
20029 class ParamAssign : public Statement {
20030 private:
20031  /// TODO
20032  std::shared_ptr<Identifier> name;
20033  /// TODO
20034  std::shared_ptr<Number> value;
20035  /// TODO
20036  std::shared_ptr<Unit> unit;
20037  /// TODO
20038  std::shared_ptr<Limits> limit;
20039  /// token with location information
20040  std::shared_ptr<ModToken> token;
20041 
20042 public:
20043  /// \name Ctor & dtor
20044  /// \{
20045 
20046  explicit ParamAssign(Identifier *name, Number *value, Unit *unit,
20047  Limits *limit);
20048  explicit ParamAssign(const std::shared_ptr<Identifier> &name,
20049  const std::shared_ptr<Number> &value,
20050  const std::shared_ptr<Unit> &unit,
20051  const std::shared_ptr<Limits> &limit);
20052  ParamAssign(const ParamAssign &obj);
20053 
20054  virtual ~ParamAssign() = default;
20055 
20056  /// \}
20057 
20058  /**
20059  * \brief Check if the ast node is an instance of ast::ParamAssign
20060  * \return true as object is of type ast::ParamAssign
20061  */
20062  bool is_param_assign() const noexcept override { return true; }
20063 
20064  /**
20065  * \brief Return a copy of the current node
20066  *
20067  * Recursively make a new copy/clone of the current node including
20068  * all members and return a pointer to the node. This is used for
20069  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20070  * ast.
20071  *
20072  * @return pointer to the clone/copy of the current node
20073  */
20074  ParamAssign *clone() const override { return new ParamAssign(*this); }
20075 
20076  /// \name Getters
20077  /// \{
20078 
20079  /**
20080  * \brief Return type (ast::AstNodeType) of ast node
20081  *
20082  * Every node in the ast has a type defined in ast::AstNodeType and this
20083  * function is used to retrieve the same.
20084  *
20085  * \return ast node type i.e. ast::AstNodeType::PARAM_ASSIGN
20086  *
20087  * \sa Ast::get_node_type_name
20088  */
20089  AstNodeType get_node_type() const noexcept override {
20091  }
20092 
20093  /**
20094  * \brief Return type (ast::AstNodeType) of ast node as std::string
20095  *
20096  * Every node in the ast has a type defined in ast::AstNodeType.
20097  * This type name can be returned as a std::string for printing
20098  * node to text/json form.
20099  *
20100  * \return name of the node type as a string i.e. "ParamAssign"
20101  *
20102  * \sa Ast::get_node_name
20103  */
20104  std::string get_node_type_name() const noexcept override {
20105  return "ParamAssign";
20106  }
20107 
20108  /**
20109  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20110  */
20111  std::shared_ptr<Ast> get_shared_ptr() override {
20112  return std::static_pointer_cast<ParamAssign>(shared_from_this());
20113  }
20114 
20115  /**
20116  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20117  */
20118  std::shared_ptr<const Ast> get_shared_ptr() const override {
20119  return std::static_pointer_cast<const ParamAssign>(shared_from_this());
20120  }
20121 
20122  /**
20123  * \brief Return associated token for the current ast node
20124  *
20125  * Not all ast nodes have token information. For example,
20126  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
20127  * solution of ODEs. In this case, we return nullptr to store in the
20128  * nmodl::symtab::SymbolTable.
20129  *
20130  * \return pointer to token if exist otherwise nullptr
20131  */
20132  const ModToken *get_token() const noexcept override { return token.get(); }
20133 
20134  /**
20135  * \brief Return name of the node
20136  *
20137  * Some ast nodes have a member marked designated as node name. For example,
20138  * in case of this ast::Identifier has name designated as a
20139  * node name.
20140  *
20141  * @return name of the node as std::string
20142  *
20143  * \sa Ast::get_node_type_name
20144  */
20145  std::string get_node_name() const override;
20146 
20147  /**
20148  * \brief Getter for member variable \ref ParamAssign.name
20149  */
20150  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
20151 
20152  /**
20153  * \brief Getter for member variable \ref ParamAssign.value
20154  */
20155  const std::shared_ptr<Number> &get_value() const noexcept { return value; }
20156 
20157  /**
20158  * \brief Getter for member variable \ref ParamAssign.unit
20159  */
20160  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
20161 
20162  /**
20163  * \brief Getter for member variable \ref ParamAssign.limit
20164  */
20165  const std::shared_ptr<Limits> &get_limit() const noexcept { return limit; }
20166 
20167  /// \}
20168 
20169  /// \name Setters
20170  /// \{
20171 
20172  /**
20173  * \brief Set token for the current ast node
20174  */
20175  void set_token(const ModToken &tok) {
20176  token = std::make_shared<ModToken>(tok);
20177  }
20178 
20179  /**
20180  * \brief Setter for member variable \ref ParamAssign.name (rvalue reference)
20181  */
20182  void set_name(std::shared_ptr<Identifier> &&name);
20183 
20184  /**
20185  * \brief Setter for member variable \ref ParamAssign.name
20186  */
20187  void set_name(const std::shared_ptr<Identifier> &name);
20188 
20189  /**
20190  * \brief Setter for member variable \ref ParamAssign.value (rvalue reference)
20191  */
20192  void set_value(std::shared_ptr<Number> &&value);
20193 
20194  /**
20195  * \brief Setter for member variable \ref ParamAssign.value
20196  */
20197  void set_value(const std::shared_ptr<Number> &value);
20198 
20199  /**
20200  * \brief Setter for member variable \ref ParamAssign.unit (rvalue reference)
20201  */
20202  void set_unit(std::shared_ptr<Unit> &&unit);
20203 
20204  /**
20205  * \brief Setter for member variable \ref ParamAssign.unit
20206  */
20207  void set_unit(const std::shared_ptr<Unit> &unit);
20208 
20209  /**
20210  * \brief Setter for member variable \ref ParamAssign.limit (rvalue reference)
20211  */
20212  void set_limit(std::shared_ptr<Limits> &&limit);
20213 
20214  /**
20215  * \brief Setter for member variable \ref ParamAssign.limit
20216  */
20217  void set_limit(const std::shared_ptr<Limits> &limit);
20218 
20219  /// \}
20220 
20221  /// \name Visitor
20222  /// \{
20223 
20224  /**
20225  * \brief visit children i.e. member variables of current node using provided
20226  * visitor
20227  *
20228  * Different nodes in the AST have different members (i.e. children). This
20229  * method recursively visits children using provided visitor.
20230  *
20231  * \param v Concrete visitor that will be used to recursively visit children
20232  *
20233  * \sa Ast::visit_children for example.
20234  */
20235  void visit_children(visitor::Visitor &v) override;
20236 
20237  /**
20238  * \brief accept (or visit) the current AST node using provided visitor
20239  *
20240  * Instead of visiting children of AST node, like Ast::visit_children,
20241  * accept allows to visit the current node itself using provided concrete
20242  * visitor.
20243  *
20244  * \param v Concrete visitor that will be used to recursively visit node
20245  *
20246  * \sa Ast::accept for example.
20247  */
20248  void accept(visitor::Visitor &v) override;
20249 
20250  /// \}
20251 
20252 private:
20253  /**
20254  * \brief Set this object as parent for all the children
20255  *
20256  * This should be called in every object (with children) constructor
20257  * to set parents. Since it is called only in the constructors it
20258  * should not be virtual to avoid ambiguities (issue #295).
20259  */
20260  void set_parent_in_children();
20261 };
20262 
20263 /** @} */ // end of ast_class
20264 
20265 } // namespace ast
20266 } // namespace nmodl
20267 #endif // !NMODL_AST_PARAM_ASSIGN_HPP
20268 #ifndef NMODL_AST_STEPPED_HPP
20269 #define NMODL_AST_STEPPED_HPP
20270 
20271 namespace nmodl {
20272 namespace ast {
20273 
20274 /**
20275  * @addtogroup ast_class
20276  * @ingroup ast
20277  * @{
20278  */
20279 
20280 /**
20281  * \brief TODO
20282  *
20283  *
20284  */
20285 class Stepped : public Statement {
20286 private:
20287  /// TODO
20288  std::shared_ptr<Name> name;
20289  /// TODO
20291  /// TODO
20292  std::shared_ptr<Unit> unit;
20293  /// token with location information
20294  std::shared_ptr<ModToken> token;
20295 
20296 public:
20297  /// \name Ctor & dtor
20298  /// \{
20299 
20300  explicit Stepped(Name *name, NumberVector values, Unit *unit);
20301  explicit Stepped(const std::shared_ptr<Name> &name,
20302  const NumberVector &values,
20303  const std::shared_ptr<Unit> &unit);
20304  Stepped(const Stepped &obj);
20305 
20306  virtual ~Stepped() = default;
20307 
20308  /// \}
20309 
20310  /**
20311  * \brief Check if the ast node is an instance of ast::Stepped
20312  * \return true as object is of type ast::Stepped
20313  */
20314  bool is_stepped() const noexcept override { return true; }
20315 
20316  /**
20317  * \brief Return a copy of the current node
20318  *
20319  * Recursively make a new copy/clone of the current node including
20320  * all members and return a pointer to the node. This is used for
20321  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20322  * ast.
20323  *
20324  * @return pointer to the clone/copy of the current node
20325  */
20326  Stepped *clone() const override { return new Stepped(*this); }
20327 
20328  /// \name Getters
20329  /// \{
20330 
20331  /**
20332  * \brief Return type (ast::AstNodeType) of ast node
20333  *
20334  * Every node in the ast has a type defined in ast::AstNodeType and this
20335  * function is used to retrieve the same.
20336  *
20337  * \return ast node type i.e. ast::AstNodeType::STEPPED
20338  *
20339  * \sa Ast::get_node_type_name
20340  */
20341  AstNodeType get_node_type() const noexcept override {
20342  return AstNodeType::STEPPED;
20343  }
20344 
20345  /**
20346  * \brief Return type (ast::AstNodeType) of ast node as std::string
20347  *
20348  * Every node in the ast has a type defined in ast::AstNodeType.
20349  * This type name can be returned as a std::string for printing
20350  * node to text/json form.
20351  *
20352  * \return name of the node type as a string i.e. "Stepped"
20353  *
20354  * \sa Ast::get_node_name
20355  */
20356  std::string get_node_type_name() const noexcept override { return "Stepped"; }
20357 
20358  /**
20359  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20360  */
20361  std::shared_ptr<Ast> get_shared_ptr() override {
20362  return std::static_pointer_cast<Stepped>(shared_from_this());
20363  }
20364 
20365  /**
20366  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20367  */
20368  std::shared_ptr<const Ast> get_shared_ptr() const override {
20369  return std::static_pointer_cast<const Stepped>(shared_from_this());
20370  }
20371 
20372  /**
20373  * \brief Return associated token for the current ast node
20374  *
20375  * Not all ast nodes have token information. For example,
20376  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
20377  * solution of ODEs. In this case, we return nullptr to store in the
20378  * nmodl::symtab::SymbolTable.
20379  *
20380  * \return pointer to token if exist otherwise nullptr
20381  */
20382  const ModToken *get_token() const noexcept override { return token.get(); }
20383 
20384  /**
20385  * \brief Getter for member variable \ref Stepped.name
20386  */
20387  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
20388 
20389  /**
20390  * \brief Getter for member variable \ref Stepped.values
20391  */
20392  const NumberVector &get_values() const noexcept { return values; }
20393 
20394  /**
20395  * \brief Getter for member variable \ref Stepped.unit
20396  */
20397  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
20398 
20399  /// \}
20400 
20401  /// \name Setters
20402  /// \{
20403 
20404  /**
20405  * \brief Set token for the current ast node
20406  */
20407  void set_token(const ModToken &tok) {
20408  token = std::make_shared<ModToken>(tok);
20409  }
20410 
20411  /**
20412  * \brief Setter for member variable \ref Stepped.name (rvalue reference)
20413  */
20414  void set_name(std::shared_ptr<Name> &&name);
20415 
20416  /**
20417  * \brief Setter for member variable \ref Stepped.name
20418  */
20419  void set_name(const std::shared_ptr<Name> &name);
20420 
20421  /**
20422  * \brief Setter for member variable \ref Stepped.values (rvalue reference)
20423  */
20424  void set_values(NumberVector &&values);
20425 
20426  /**
20427  * \brief Setter for member variable \ref Stepped.values
20428  */
20429  void set_values(const NumberVector &values);
20430 
20431  /**
20432  * \brief Setter for member variable \ref Stepped.unit (rvalue reference)
20433  */
20434  void set_unit(std::shared_ptr<Unit> &&unit);
20435 
20436  /**
20437  * \brief Setter for member variable \ref Stepped.unit
20438  */
20439  void set_unit(const std::shared_ptr<Unit> &unit);
20440 
20441  /// \}
20442 
20443  /// \name Visitor
20444  /// \{
20445 
20446  /**
20447  * \brief visit children i.e. member variables of current node using provided
20448  * visitor
20449  *
20450  * Different nodes in the AST have different members (i.e. children). This
20451  * method recursively visits children using provided visitor.
20452  *
20453  * \param v Concrete visitor that will be used to recursively visit children
20454  *
20455  * \sa Ast::visit_children for example.
20456  */
20457  void visit_children(visitor::Visitor &v) override;
20458 
20459  /**
20460  * \brief accept (or visit) the current AST node using provided visitor
20461  *
20462  * Instead of visiting children of AST node, like Ast::visit_children,
20463  * accept allows to visit the current node itself using provided concrete
20464  * visitor.
20465  *
20466  * \param v Concrete visitor that will be used to recursively visit node
20467  *
20468  * \sa Ast::accept for example.
20469  */
20470  void accept(visitor::Visitor &v) override;
20471 
20472  /// \}
20473 
20474 private:
20475  /**
20476  * \brief Set this object as parent for all the children
20477  *
20478  * This should be called in every object (with children) constructor
20479  * to set parents. Since it is called only in the constructors it
20480  * should not be virtual to avoid ambiguities (issue #295).
20481  */
20482  void set_parent_in_children();
20483 };
20484 
20485 /** @} */ // end of ast_class
20486 
20487 } // namespace ast
20488 } // namespace nmodl
20489 #endif // !NMODL_AST_STEPPED_HPP
20490 #ifndef NMODL_AST_INDEPENDENT_DEFINITION_HPP
20491 #define NMODL_AST_INDEPENDENT_DEFINITION_HPP
20492 
20493 namespace nmodl {
20494 namespace ast {
20495 
20496 /**
20497  * @addtogroup ast_class
20498  * @ingroup ast
20499  * @{
20500  */
20501 
20502 /**
20503  * \brief TODO
20504  *
20505  *
20506  */
20508 private:
20509  /// TODO
20510  std::shared_ptr<Boolean> sweep;
20511  /// TODO
20512  std::shared_ptr<Name> name;
20513  /// TODO
20514  std::shared_ptr<Number> from;
20515  /// TODO
20516  std::shared_ptr<Number> to;
20517  /// TODO
20518  std::shared_ptr<Integer> with;
20519  /// TODO
20520  std::shared_ptr<Number> start;
20521  /// TODO
20522  std::shared_ptr<Unit> unit;
20523  /// token with location information
20524  std::shared_ptr<ModToken> token;
20525 
20526 public:
20527  /// \name Ctor & dtor
20528  /// \{
20529 
20530  explicit IndependentDefinition(Boolean *sweep, Name *name, Number *from,
20531  Number *to, Integer *with, Number *start,
20532  Unit *unit);
20533  explicit IndependentDefinition(const std::shared_ptr<Boolean> &sweep,
20534  const std::shared_ptr<Name> &name,
20535  const std::shared_ptr<Number> &from,
20536  const std::shared_ptr<Number> &to,
20537  const std::shared_ptr<Integer> &with,
20538  const std::shared_ptr<Number> &start,
20539  const std::shared_ptr<Unit> &unit);
20541 
20542  virtual ~IndependentDefinition() = default;
20543 
20544  /// \}
20545 
20546  /**
20547  * \brief Check if the ast node is an instance of ast::IndependentDefinition
20548  * \return true as object is of type ast::IndependentDefinition
20549  */
20550  bool is_independent_definition() const noexcept override { return true; }
20551 
20552  /**
20553  * \brief Return a copy of the current node
20554  *
20555  * Recursively make a new copy/clone of the current node including
20556  * all members and return a pointer to the node. This is used for
20557  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20558  * ast.
20559  *
20560  * @return pointer to the clone/copy of the current node
20561  */
20562  IndependentDefinition *clone() const override {
20563  return new IndependentDefinition(*this);
20564  }
20565 
20566  /// \name Getters
20567  /// \{
20568 
20569  /**
20570  * \brief Return type (ast::AstNodeType) of ast node
20571  *
20572  * Every node in the ast has a type defined in ast::AstNodeType and this
20573  * function is used to retrieve the same.
20574  *
20575  * \return ast node type i.e. ast::AstNodeType::INDEPENDENT_DEFINITION
20576  *
20577  * \sa Ast::get_node_type_name
20578  */
20579  AstNodeType get_node_type() const noexcept override {
20581  }
20582 
20583  /**
20584  * \brief Return type (ast::AstNodeType) of ast node as std::string
20585  *
20586  * Every node in the ast has a type defined in ast::AstNodeType.
20587  * This type name can be returned as a std::string for printing
20588  * node to text/json form.
20589  *
20590  * \return name of the node type as a string i.e. "IndependentDefinition"
20591  *
20592  * \sa Ast::get_node_name
20593  */
20594  std::string get_node_type_name() const noexcept override {
20595  return "IndependentDefinition";
20596  }
20597 
20598  /**
20599  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20600  */
20601  std::shared_ptr<Ast> get_shared_ptr() override {
20602  return std::static_pointer_cast<IndependentDefinition>(shared_from_this());
20603  }
20604 
20605  /**
20606  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20607  */
20608  std::shared_ptr<const Ast> get_shared_ptr() const override {
20609  return std::static_pointer_cast<const IndependentDefinition>(
20610  shared_from_this());
20611  }
20612 
20613  /**
20614  * \brief Return associated token for the current ast node
20615  *
20616  * Not all ast nodes have token information. For example,
20617  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
20618  * solution of ODEs. In this case, we return nullptr to store in the
20619  * nmodl::symtab::SymbolTable.
20620  *
20621  * \return pointer to token if exist otherwise nullptr
20622  */
20623  const ModToken *get_token() const noexcept override { return token.get(); }
20624 
20625  /**
20626  * \brief Getter for member variable \ref IndependentDefinition.sweep
20627  */
20628  const std::shared_ptr<Boolean> &get_sweep() const noexcept { return sweep; }
20629 
20630  /**
20631  * \brief Getter for member variable \ref IndependentDefinition.name
20632  */
20633  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
20634 
20635  /**
20636  * \brief Getter for member variable \ref IndependentDefinition.from
20637  */
20638  const std::shared_ptr<Number> &get_from() const noexcept { return from; }
20639 
20640  /**
20641  * \brief Getter for member variable \ref IndependentDefinition.to
20642  */
20643  const std::shared_ptr<Number> &get_to() const noexcept { return to; }
20644 
20645  /**
20646  * \brief Getter for member variable \ref IndependentDefinition.with
20647  */
20648  const std::shared_ptr<Integer> &get_with() const noexcept { return with; }
20649 
20650  /**
20651  * \brief Getter for member variable \ref IndependentDefinition.start
20652  */
20653  const std::shared_ptr<Number> &get_start() const noexcept { return start; }
20654 
20655  /**
20656  * \brief Getter for member variable \ref IndependentDefinition.unit
20657  */
20658  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
20659 
20660  /// \}
20661 
20662  /// \name Setters
20663  /// \{
20664 
20665  /**
20666  * \brief Set token for the current ast node
20667  */
20668  void set_token(const ModToken &tok) {
20669  token = std::make_shared<ModToken>(tok);
20670  }
20671 
20672  /**
20673  * \brief Setter for member variable \ref IndependentDefinition.sweep (rvalue
20674  * reference)
20675  */
20676  void set_sweep(std::shared_ptr<Boolean> &&sweep);
20677 
20678  /**
20679  * \brief Setter for member variable \ref IndependentDefinition.sweep
20680  */
20681  void set_sweep(const std::shared_ptr<Boolean> &sweep);
20682 
20683  /**
20684  * \brief Setter for member variable \ref IndependentDefinition.name (rvalue
20685  * reference)
20686  */
20687  void set_name(std::shared_ptr<Name> &&name);
20688 
20689  /**
20690  * \brief Setter for member variable \ref IndependentDefinition.name
20691  */
20692  void set_name(const std::shared_ptr<Name> &name);
20693 
20694  /**
20695  * \brief Setter for member variable \ref IndependentDefinition.from (rvalue
20696  * reference)
20697  */
20698  void set_from(std::shared_ptr<Number> &&from);
20699 
20700  /**
20701  * \brief Setter for member variable \ref IndependentDefinition.from
20702  */
20703  void set_from(const std::shared_ptr<Number> &from);
20704 
20705  /**
20706  * \brief Setter for member variable \ref IndependentDefinition.to (rvalue
20707  * reference)
20708  */
20709  void set_to(std::shared_ptr<Number> &&to);
20710 
20711  /**
20712  * \brief Setter for member variable \ref IndependentDefinition.to
20713  */
20714  void set_to(const std::shared_ptr<Number> &to);
20715 
20716  /**
20717  * \brief Setter for member variable \ref IndependentDefinition.with (rvalue
20718  * reference)
20719  */
20720  void set_with(std::shared_ptr<Integer> &&with);
20721 
20722  /**
20723  * \brief Setter for member variable \ref IndependentDefinition.with
20724  */
20725  void set_with(const std::shared_ptr<Integer> &with);
20726 
20727  /**
20728  * \brief Setter for member variable \ref IndependentDefinition.start (rvalue
20729  * reference)
20730  */
20731  void set_start(std::shared_ptr<Number> &&start);
20732 
20733  /**
20734  * \brief Setter for member variable \ref IndependentDefinition.start
20735  */
20736  void set_start(const std::shared_ptr<Number> &start);
20737 
20738  /**
20739  * \brief Setter for member variable \ref IndependentDefinition.unit (rvalue
20740  * reference)
20741  */
20742  void set_unit(std::shared_ptr<Unit> &&unit);
20743 
20744  /**
20745  * \brief Setter for member variable \ref IndependentDefinition.unit
20746  */
20747  void set_unit(const std::shared_ptr<Unit> &unit);
20748 
20749  /// \}
20750 
20751  /// \name Visitor
20752  /// \{
20753 
20754  /**
20755  * \brief visit children i.e. member variables of current node using provided
20756  * visitor
20757  *
20758  * Different nodes in the AST have different members (i.e. children). This
20759  * method recursively visits children using provided visitor.
20760  *
20761  * \param v Concrete visitor that will be used to recursively visit children
20762  *
20763  * \sa Ast::visit_children for example.
20764  */
20765  void visit_children(visitor::Visitor &v) override;
20766 
20767  /**
20768  * \brief accept (or visit) the current AST node using provided visitor
20769  *
20770  * Instead of visiting children of AST node, like Ast::visit_children,
20771  * accept allows to visit the current node itself using provided concrete
20772  * visitor.
20773  *
20774  * \param v Concrete visitor that will be used to recursively visit node
20775  *
20776  * \sa Ast::accept for example.
20777  */
20778  void accept(visitor::Visitor &v) override;
20779 
20780  /// \}
20781 
20782 private:
20783  /**
20784  * \brief Set this object as parent for all the children
20785  *
20786  * This should be called in every object (with children) constructor
20787  * to set parents. Since it is called only in the constructors it
20788  * should not be virtual to avoid ambiguities (issue #295).
20789  */
20790  void set_parent_in_children();
20791 };
20792 
20793 /** @} */ // end of ast_class
20794 
20795 } // namespace ast
20796 } // namespace nmodl
20797 #endif // !NMODL_AST_INDEPENDENT_DEFINITION_HPP
20798 #ifndef NMODL_AST_ASSIGNED_DEFINITION_HPP
20799 #define NMODL_AST_ASSIGNED_DEFINITION_HPP
20800 
20801 namespace nmodl {
20802 namespace ast {
20803 
20804 /**
20805  * @addtogroup ast_class
20806  * @ingroup ast
20807  * @{
20808  */
20809 
20810 /**
20811  * \brief Represents a statement in `ASSIGNED` or `STATE` block
20812  *
20813  *
20814  */
20816 private:
20817  /// Name of the variable
20818  std::shared_ptr<Identifier> name;
20819  /// Length in case of array
20820  std::shared_ptr<Integer> length;
20821  /// TODO
20822  std::shared_ptr<Number> from;
20823  /// TODO
20824  std::shared_ptr<Number> to;
20825  /// TODO
20826  std::shared_ptr<Number> start;
20827  /// TODO
20828  std::shared_ptr<Unit> unit;
20829  /// TODO
20830  std::shared_ptr<Double> abstol;
20831  /// token with location information
20832  std::shared_ptr<ModToken> token;
20833 
20834 public:
20835  /// \name Ctor & dtor
20836  /// \{
20837 
20838  explicit AssignedDefinition(Identifier *name, Integer *length, Number *from,
20839  Number *to, Number *start, Unit *unit,
20840  Double *abstol);
20841  explicit AssignedDefinition(const std::shared_ptr<Identifier> &name,
20842  const std::shared_ptr<Integer> &length,
20843  const std::shared_ptr<Number> &from,
20844  const std::shared_ptr<Number> &to,
20845  const std::shared_ptr<Number> &start,
20846  const std::shared_ptr<Unit> &unit,
20847  const std::shared_ptr<Double> &abstol);
20849 
20850  virtual ~AssignedDefinition() = default;
20851 
20852  /// \}
20853 
20854  /**
20855  * \brief Check if the ast node is an instance of ast::AssignedDefinition
20856  * \return true as object is of type ast::AssignedDefinition
20857  */
20858  bool is_assigned_definition() const noexcept override { return true; }
20859 
20860  /**
20861  * \brief Return a copy of the current node
20862  *
20863  * Recursively make a new copy/clone of the current node including
20864  * all members and return a pointer to the node. This is used for
20865  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20866  * ast.
20867  *
20868  * @return pointer to the clone/copy of the current node
20869  */
20870  AssignedDefinition *clone() const override {
20871  return new AssignedDefinition(*this);
20872  }
20873 
20874  /// \name Getters
20875  /// \{
20876 
20877  /**
20878  * \brief Return type (ast::AstNodeType) of ast node
20879  *
20880  * Every node in the ast has a type defined in ast::AstNodeType and this
20881  * function is used to retrieve the same.
20882  *
20883  * \return ast node type i.e. ast::AstNodeType::ASSIGNED_DEFINITION
20884  *
20885  * \sa Ast::get_node_type_name
20886  */
20887  AstNodeType get_node_type() const noexcept override {
20889  }
20890 
20891  /**
20892  * \brief Return type (ast::AstNodeType) of ast node as std::string
20893  *
20894  * Every node in the ast has a type defined in ast::AstNodeType.
20895  * This type name can be returned as a std::string for printing
20896  * node to text/json form.
20897  *
20898  * \return name of the node type as a string i.e. "AssignedDefinition"
20899  *
20900  * \sa Ast::get_node_name
20901  */
20902  std::string get_node_type_name() const noexcept override {
20903  return "AssignedDefinition";
20904  }
20905 
20906  /**
20907  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20908  */
20909  std::shared_ptr<Ast> get_shared_ptr() override {
20910  return std::static_pointer_cast<AssignedDefinition>(shared_from_this());
20911  }
20912 
20913  /**
20914  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20915  */
20916  std::shared_ptr<const Ast> get_shared_ptr() const override {
20917  return std::static_pointer_cast<const AssignedDefinition>(
20918  shared_from_this());
20919  }
20920 
20921  /**
20922  * \brief Return associated token for the current ast node
20923  *
20924  * Not all ast nodes have token information. For example,
20925  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
20926  * solution of ODEs. In this case, we return nullptr to store in the
20927  * nmodl::symtab::SymbolTable.
20928  *
20929  * \return pointer to token if exist otherwise nullptr
20930  */
20931  const ModToken *get_token() const noexcept override { return token.get(); }
20932 
20933  /**
20934  * \brief Return name of the node
20935  *
20936  * Some ast nodes have a member marked designated as node name. For example,
20937  * in case of this ast::Identifier has name designated as a
20938  * node name.
20939  *
20940  * @return name of the node as std::string
20941  *
20942  * \sa Ast::get_node_type_name
20943  */
20944  std::string get_node_name() const override;
20945 
20946  /**
20947  * \brief Getter for member variable \ref AssignedDefinition.name
20948  */
20949  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
20950 
20951  /**
20952  * \brief Getter for member variable \ref AssignedDefinition.length
20953  */
20954  const std::shared_ptr<Integer> &get_length() const noexcept { return length; }
20955 
20956  /**
20957  * \brief Getter for member variable \ref AssignedDefinition.from
20958  */
20959  const std::shared_ptr<Number> &get_from() const noexcept { return from; }
20960 
20961  /**
20962  * \brief Getter for member variable \ref AssignedDefinition.to
20963  */
20964  const std::shared_ptr<Number> &get_to() const noexcept { return to; }
20965 
20966  /**
20967  * \brief Getter for member variable \ref AssignedDefinition.start
20968  */
20969  const std::shared_ptr<Number> &get_start() const noexcept { return start; }
20970 
20971  /**
20972  * \brief Getter for member variable \ref AssignedDefinition.unit
20973  */
20974  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
20975 
20976  /**
20977  * \brief Getter for member variable \ref AssignedDefinition.abstol
20978  */
20979  const std::shared_ptr<Double> &get_abstol() const noexcept { return abstol; }
20980 
20981  /// \}
20982 
20983  /// \name Setters
20984  /// \{
20985 
20986  /**
20987  * \brief Set token for the current ast node
20988  */
20989  void set_token(const ModToken &tok) {
20990  token = std::make_shared<ModToken>(tok);
20991  }
20992 
20993  /**
20994  * \brief Setter for member variable \ref AssignedDefinition.name (rvalue
20995  * reference)
20996  */
20997  void set_name(std::shared_ptr<Identifier> &&name);
20998 
20999  /**
21000  * \brief Setter for member variable \ref AssignedDefinition.name
21001  */
21002  void set_name(const std::shared_ptr<Identifier> &name);
21003 
21004  /**
21005  * \brief Setter for member variable \ref AssignedDefinition.length (rvalue
21006  * reference)
21007  */
21008  void set_length(std::shared_ptr<Integer> &&length);
21009 
21010  /**
21011  * \brief Setter for member variable \ref AssignedDefinition.length
21012  */
21013  void set_length(const std::shared_ptr<Integer> &length);
21014 
21015  /**
21016  * \brief Setter for member variable \ref AssignedDefinition.from (rvalue
21017  * reference)
21018  */
21019  void set_from(std::shared_ptr<Number> &&from);
21020 
21021  /**
21022  * \brief Setter for member variable \ref AssignedDefinition.from
21023  */
21024  void set_from(const std::shared_ptr<Number> &from);
21025 
21026  /**
21027  * \brief Setter for member variable \ref AssignedDefinition.to (rvalue
21028  * reference)
21029  */
21030  void set_to(std::shared_ptr<Number> &&to);
21031 
21032  /**
21033  * \brief Setter for member variable \ref AssignedDefinition.to
21034  */
21035  void set_to(const std::shared_ptr<Number> &to);
21036 
21037  /**
21038  * \brief Setter for member variable \ref AssignedDefinition.start (rvalue
21039  * reference)
21040  */
21041  void set_start(std::shared_ptr<Number> &&start);
21042 
21043  /**
21044  * \brief Setter for member variable \ref AssignedDefinition.start
21045  */
21046  void set_start(const std::shared_ptr<Number> &start);
21047 
21048  /**
21049  * \brief Setter for member variable \ref AssignedDefinition.unit (rvalue
21050  * reference)
21051  */
21052  void set_unit(std::shared_ptr<Unit> &&unit);
21053 
21054  /**
21055  * \brief Setter for member variable \ref AssignedDefinition.unit
21056  */
21057  void set_unit(const std::shared_ptr<Unit> &unit);
21058 
21059  /**
21060  * \brief Setter for member variable \ref AssignedDefinition.abstol (rvalue
21061  * reference)
21062  */
21063  void set_abstol(std::shared_ptr<Double> &&abstol);
21064 
21065  /**
21066  * \brief Setter for member variable \ref AssignedDefinition.abstol
21067  */
21068  void set_abstol(const std::shared_ptr<Double> &abstol);
21069 
21070  /// \}
21071 
21072  /// \name Visitor
21073  /// \{
21074 
21075  /**
21076  * \brief visit children i.e. member variables of current node using provided
21077  * visitor
21078  *
21079  * Different nodes in the AST have different members (i.e. children). This
21080  * method recursively visits children using provided visitor.
21081  *
21082  * \param v Concrete visitor that will be used to recursively visit children
21083  *
21084  * \sa Ast::visit_children for example.
21085  */
21086  void visit_children(visitor::Visitor &v) override;
21087 
21088  /**
21089  * \brief accept (or visit) the current AST node using provided visitor
21090  *
21091  * Instead of visiting children of AST node, like Ast::visit_children,
21092  * accept allows to visit the current node itself using provided concrete
21093  * visitor.
21094  *
21095  * \param v Concrete visitor that will be used to recursively visit node
21096  *
21097  * \sa Ast::accept for example.
21098  */
21099  void accept(visitor::Visitor &v) override;
21100 
21101  /// \}
21102 
21103 private:
21104  /**
21105  * \brief Set this object as parent for all the children
21106  *
21107  * This should be called in every object (with children) constructor
21108  * to set parents. Since it is called only in the constructors it
21109  * should not be virtual to avoid ambiguities (issue #295).
21110  */
21111  void set_parent_in_children();
21112 };
21113 
21114 /** @} */ // end of ast_class
21115 
21116 } // namespace ast
21117 } // namespace nmodl
21118 #endif // !NMODL_AST_ASSIGNED_DEFINITION_HPP
21119 #ifndef NMODL_AST_PLOT_DECLARATION_HPP
21120 #define NMODL_AST_PLOT_DECLARATION_HPP
21121 
21122 namespace nmodl {
21123 namespace ast {
21124 
21125 /**
21126  * @addtogroup ast_class
21127  * @ingroup ast
21128  * @{
21129  */
21130 
21131 /**
21132  * \brief TODO
21133  *
21134  *
21135  */
21136 class PlotDeclaration : public Statement {
21137 private:
21138  /// TODO
21140  /// TODO
21141  std::shared_ptr<PlotVar> name;
21142  /// token with location information
21143  std::shared_ptr<ModToken> token;
21144 
21145 public:
21146  /// \name Ctor & dtor
21147  /// \{
21148 
21149  explicit PlotDeclaration(PlotVarVector variables, PlotVar *name);
21150  explicit PlotDeclaration(const PlotVarVector &variables,
21151  const std::shared_ptr<PlotVar> &name);
21152  PlotDeclaration(const PlotDeclaration &obj);
21153 
21154  virtual ~PlotDeclaration() = default;
21155 
21156  /// \}
21157 
21158  /**
21159  * \brief Check if the ast node is an instance of ast::PlotDeclaration
21160  * \return true as object is of type ast::PlotDeclaration
21161  */
21162  bool is_plot_declaration() const noexcept override { return true; }
21163 
21164  /**
21165  * \brief Return a copy of the current node
21166  *
21167  * Recursively make a new copy/clone of the current node including
21168  * all members and return a pointer to the node. This is used for
21169  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21170  * ast.
21171  *
21172  * @return pointer to the clone/copy of the current node
21173  */
21174  PlotDeclaration *clone() const override { return new PlotDeclaration(*this); }
21175 
21176  /// \name Getters
21177  /// \{
21178 
21179  /**
21180  * \brief Return type (ast::AstNodeType) of ast node
21181  *
21182  * Every node in the ast has a type defined in ast::AstNodeType and this
21183  * function is used to retrieve the same.
21184  *
21185  * \return ast node type i.e. ast::AstNodeType::PLOT_DECLARATION
21186  *
21187  * \sa Ast::get_node_type_name
21188  */
21189  AstNodeType get_node_type() const noexcept override {
21191  }
21192 
21193  /**
21194  * \brief Return type (ast::AstNodeType) of ast node as std::string
21195  *
21196  * Every node in the ast has a type defined in ast::AstNodeType.
21197  * This type name can be returned as a std::string for printing
21198  * node to text/json form.
21199  *
21200  * \return name of the node type as a string i.e. "PlotDeclaration"
21201  *
21202  * \sa Ast::get_node_name
21203  */
21204  std::string get_node_type_name() const noexcept override {
21205  return "PlotDeclaration";
21206  }
21207 
21208  /**
21209  * \brief Return NMODL statement of ast node as std::string
21210  *
21211  * Every node is related to a special statement in the NMODL. This
21212  * statement can be returned as a std::string for printing to
21213  * text/json form.
21214  *
21215  * \return name of the statement as a string i.e. "PLOT "
21216  *
21217  * \sa Ast::get_nmodl_name
21218  */
21219  std::string get_nmodl_name() const noexcept override { return "PLOT "; }
21220 
21221  /**
21222  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21223  */
21224  std::shared_ptr<Ast> get_shared_ptr() override {
21225  return std::static_pointer_cast<PlotDeclaration>(shared_from_this());
21226  }
21227 
21228  /**
21229  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21230  */
21231  std::shared_ptr<const Ast> get_shared_ptr() const override {
21232  return std::static_pointer_cast<const PlotDeclaration>(shared_from_this());
21233  }
21234 
21235  /**
21236  * \brief Return associated token for the current ast node
21237  *
21238  * Not all ast nodes have token information. For example,
21239  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
21240  * solution of ODEs. In this case, we return nullptr to store in the
21241  * nmodl::symtab::SymbolTable.
21242  *
21243  * \return pointer to token if exist otherwise nullptr
21244  */
21245  const ModToken *get_token() const noexcept override { return token.get(); }
21246 
21247  /**
21248  * \brief Getter for member variable \ref PlotDeclaration.variables
21249  */
21250  const PlotVarVector &get_variables() const noexcept { return variables; }
21251 
21252  /**
21253  * \brief Getter for member variable \ref PlotDeclaration.name
21254  */
21255  const std::shared_ptr<PlotVar> &get_name() const noexcept { return name; }
21256 
21257  /// \}
21258 
21259  /// \name Setters
21260  /// \{
21261 
21262  /**
21263  * \brief Set token for the current ast node
21264  */
21265  void set_token(const ModToken &tok) {
21266  token = std::make_shared<ModToken>(tok);
21267  }
21268 
21269  /**
21270  * \brief Setter for member variable \ref PlotDeclaration.variables (rvalue
21271  * reference)
21272  */
21273  void set_variables(PlotVarVector &&variables);
21274 
21275  /**
21276  * \brief Setter for member variable \ref PlotDeclaration.variables
21277  */
21278  void set_variables(const PlotVarVector &variables);
21279 
21280  /**
21281  * \brief Setter for member variable \ref PlotDeclaration.name (rvalue
21282  * reference)
21283  */
21284  void set_name(std::shared_ptr<PlotVar> &&name);
21285 
21286  /**
21287  * \brief Setter for member variable \ref PlotDeclaration.name
21288  */
21289  void set_name(const std::shared_ptr<PlotVar> &name);
21290 
21291  /// \}
21292 
21293  /// \name Visitor
21294  /// \{
21295 
21296  /**
21297  * \brief visit children i.e. member variables of current node using provided
21298  * visitor
21299  *
21300  * Different nodes in the AST have different members (i.e. children). This
21301  * method recursively visits children using provided visitor.
21302  *
21303  * \param v Concrete visitor that will be used to recursively visit children
21304  *
21305  * \sa Ast::visit_children for example.
21306  */
21307  void visit_children(visitor::Visitor &v) override;
21308 
21309  /**
21310  * \brief accept (or visit) the current AST node using provided visitor
21311  *
21312  * Instead of visiting children of AST node, like Ast::visit_children,
21313  * accept allows to visit the current node itself using provided concrete
21314  * visitor.
21315  *
21316  * \param v Concrete visitor that will be used to recursively visit node
21317  *
21318  * \sa Ast::accept for example.
21319  */
21320  void accept(visitor::Visitor &v) override;
21321 
21322  /// \}
21323 
21324 private:
21325  /**
21326  * \brief Set this object as parent for all the children
21327  *
21328  * This should be called in every object (with children) constructor
21329  * to set parents. Since it is called only in the constructors it
21330  * should not be virtual to avoid ambiguities (issue #295).
21331  */
21332  void set_parent_in_children();
21333 };
21334 
21335 /** @} */ // end of ast_class
21336 
21337 } // namespace ast
21338 } // namespace nmodl
21339 #endif // !NMODL_AST_PLOT_DECLARATION_HPP
21340 #ifndef NMODL_AST_CONDUCTANCE_HINT_HPP
21341 #define NMODL_AST_CONDUCTANCE_HINT_HPP
21342 
21343 namespace nmodl {
21344 namespace ast {
21345 
21346 /**
21347  * @addtogroup ast_class
21348  * @ingroup ast
21349  * @{
21350  */
21351 
21352 /**
21353  * \brief Represents `CONDUCTANCE` statement in NMODL
21354  *
21355  * If `I/V` relation in the `BREAKPOINT` block is ohomic then one can
21356  * specify `CONDUCTANCE` hint for optimised code generation:
21357  *
21358  * \code{.mod}
21359  * CONDUCTANCE g USEION I
21360  * \endcode
21361  *
21362  * \sa nmodl::visitor::SympyConductanceVisitor
21363  *
21364  */
21365 class ConductanceHint : public Statement {
21366 private:
21367  /// Conductance variable
21368  std::shared_ptr<Name> conductance;
21369  /// Ion name
21370  std::shared_ptr<Name> ion;
21371  /// token with location information
21372  std::shared_ptr<ModToken> token;
21373 
21374 public:
21375  /// \name Ctor & dtor
21376  /// \{
21377 
21378  explicit ConductanceHint(Name *conductance, Name *ion);
21379  explicit ConductanceHint(const std::shared_ptr<Name> &conductance,
21380  const std::shared_ptr<Name> &ion);
21381  ConductanceHint(const ConductanceHint &obj);
21382 
21383  virtual ~ConductanceHint() = default;
21384 
21385  /// \}
21386 
21387  /**
21388  * \brief Check if the ast node is an instance of ast::ConductanceHint
21389  * \return true as object is of type ast::ConductanceHint
21390  */
21391  bool is_conductance_hint() const noexcept override { return true; }
21392 
21393  /**
21394  * \brief Return a copy of the current node
21395  *
21396  * Recursively make a new copy/clone of the current node including
21397  * all members and return a pointer to the node. This is used for
21398  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21399  * ast.
21400  *
21401  * @return pointer to the clone/copy of the current node
21402  */
21403  ConductanceHint *clone() const override { return new ConductanceHint(*this); }
21404 
21405  /// \name Getters
21406  /// \{
21407 
21408  /**
21409  * \brief Return type (ast::AstNodeType) of ast node
21410  *
21411  * Every node in the ast has a type defined in ast::AstNodeType and this
21412  * function is used to retrieve the same.
21413  *
21414  * \return ast node type i.e. ast::AstNodeType::CONDUCTANCE_HINT
21415  *
21416  * \sa Ast::get_node_type_name
21417  */
21418  AstNodeType get_node_type() const noexcept override {
21420  }
21421 
21422  /**
21423  * \brief Return type (ast::AstNodeType) of ast node as std::string
21424  *
21425  * Every node in the ast has a type defined in ast::AstNodeType.
21426  * This type name can be returned as a std::string for printing
21427  * node to text/json form.
21428  *
21429  * \return name of the node type as a string i.e. "ConductanceHint"
21430  *
21431  * \sa Ast::get_node_name
21432  */
21433  std::string get_node_type_name() const noexcept override {
21434  return "ConductanceHint";
21435  }
21436 
21437  /**
21438  * \brief Return NMODL statement of ast node as std::string
21439  *
21440  * Every node is related to a special statement in the NMODL. This
21441  * statement can be returned as a std::string for printing to
21442  * text/json form.
21443  *
21444  * \return name of the statement as a string i.e. "CONDUCTANCE "
21445  *
21446  * \sa Ast::get_nmodl_name
21447  */
21448  std::string get_nmodl_name() const noexcept override {
21449  return "CONDUCTANCE ";
21450  }
21451 
21452  /**
21453  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21454  */
21455  std::shared_ptr<Ast> get_shared_ptr() override {
21456  return std::static_pointer_cast<ConductanceHint>(shared_from_this());
21457  }
21458 
21459  /**
21460  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21461  */
21462  std::shared_ptr<const Ast> get_shared_ptr() const override {
21463  return std::static_pointer_cast<const ConductanceHint>(shared_from_this());
21464  }
21465 
21466  /**
21467  * \brief Return associated token for the current ast node
21468  *
21469  * Not all ast nodes have token information. For example,
21470  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
21471  * solution of ODEs. In this case, we return nullptr to store in the
21472  * nmodl::symtab::SymbolTable.
21473  *
21474  * \return pointer to token if exist otherwise nullptr
21475  */
21476  const ModToken *get_token() const noexcept override { return token.get(); }
21477 
21478  /**
21479  * \brief Getter for member variable \ref ConductanceHint.conductance
21480  */
21481  const std::shared_ptr<Name> &get_conductance() const noexcept {
21482  return conductance;
21483  }
21484 
21485  /**
21486  * \brief Getter for member variable \ref ConductanceHint.ion
21487  */
21488  const std::shared_ptr<Name> &get_ion() const noexcept { return ion; }
21489 
21490  /// \}
21491 
21492  /// \name Setters
21493  /// \{
21494 
21495  /**
21496  * \brief Set token for the current ast node
21497  */
21498  void set_token(const ModToken &tok) {
21499  token = std::make_shared<ModToken>(tok);
21500  }
21501 
21502  /**
21503  * \brief Setter for member variable \ref ConductanceHint.conductance (rvalue
21504  * reference)
21505  */
21506  void set_conductance(std::shared_ptr<Name> &&conductance);
21507 
21508  /**
21509  * \brief Setter for member variable \ref ConductanceHint.conductance
21510  */
21511  void set_conductance(const std::shared_ptr<Name> &conductance);
21512 
21513  /**
21514  * \brief Setter for member variable \ref ConductanceHint.ion (rvalue
21515  * reference)
21516  */
21517  void set_ion(std::shared_ptr<Name> &&ion);
21518 
21519  /**
21520  * \brief Setter for member variable \ref ConductanceHint.ion
21521  */
21522  void set_ion(const std::shared_ptr<Name> &ion);
21523 
21524  /// \}
21525 
21526  /// \name Visitor
21527  /// \{
21528 
21529  /**
21530  * \brief visit children i.e. member variables of current node using provided
21531  * visitor
21532  *
21533  * Different nodes in the AST have different members (i.e. children). This
21534  * method recursively visits children using provided visitor.
21535  *
21536  * \param v Concrete visitor that will be used to recursively visit children
21537  *
21538  * \sa Ast::visit_children for example.
21539  */
21540  void visit_children(visitor::Visitor &v) override;
21541 
21542  /**
21543  * \brief accept (or visit) the current AST node using provided visitor
21544  *
21545  * Instead of visiting children of AST node, like Ast::visit_children,
21546  * accept allows to visit the current node itself using provided concrete
21547  * visitor.
21548  *
21549  * \param v Concrete visitor that will be used to recursively visit node
21550  *
21551  * \sa Ast::accept for example.
21552  */
21553  void accept(visitor::Visitor &v) override;
21554 
21555  /// \}
21556 
21557 private:
21558  /**
21559  * \brief Set this object as parent for all the children
21560  *
21561  * This should be called in every object (with children) constructor
21562  * to set parents. Since it is called only in the constructors it
21563  * should not be virtual to avoid ambiguities (issue #295).
21564  */
21565  void set_parent_in_children();
21566 };
21567 
21568 /** @} */ // end of ast_class
21569 
21570 } // namespace ast
21571 } // namespace nmodl
21572 #endif // !NMODL_AST_CONDUCTANCE_HINT_HPP
21573 #ifndef NMODL_AST_EXPRESSION_STATEMENT_HPP
21574 #define NMODL_AST_EXPRESSION_STATEMENT_HPP
21575 
21576 namespace nmodl {
21577 namespace ast {
21578 
21579 /**
21580  * @addtogroup ast_class
21581  * @ingroup ast
21582  * @{
21583  */
21584 
21585 /**
21586  * \brief TODO
21587  *
21588  *
21589  */
21591 private:
21592  /// TODO
21593  std::shared_ptr<Expression> expression;
21594  /// token with location information
21595  std::shared_ptr<ModToken> token;
21596 
21597 public:
21598  /// \name Ctor & dtor
21599  /// \{
21600 
21601  explicit ExpressionStatement(Expression *expression);
21602  explicit ExpressionStatement(const std::shared_ptr<Expression> &expression);
21604 
21605  virtual ~ExpressionStatement() = default;
21606 
21607  /// \}
21608 
21609  /**
21610  * \brief Check if the ast node is an instance of ast::ExpressionStatement
21611  * \return true as object is of type ast::ExpressionStatement
21612  */
21613  bool is_expression_statement() const noexcept override { return true; }
21614 
21615  /**
21616  * \brief Return a copy of the current node
21617  *
21618  * Recursively make a new copy/clone of the current node including
21619  * all members and return a pointer to the node. This is used for
21620  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21621  * ast.
21622  *
21623  * @return pointer to the clone/copy of the current node
21624  */
21625  ExpressionStatement *clone() const override {
21626  return new ExpressionStatement(*this);
21627  }
21628 
21629  /// \name Getters
21630  /// \{
21631 
21632  /**
21633  * \brief Return type (ast::AstNodeType) of ast node
21634  *
21635  * Every node in the ast has a type defined in ast::AstNodeType and this
21636  * function is used to retrieve the same.
21637  *
21638  * \return ast node type i.e. ast::AstNodeType::EXPRESSION_STATEMENT
21639  *
21640  * \sa Ast::get_node_type_name
21641  */
21642  AstNodeType get_node_type() const noexcept override {
21644  }
21645 
21646  /**
21647  * \brief Return type (ast::AstNodeType) of ast node as std::string
21648  *
21649  * Every node in the ast has a type defined in ast::AstNodeType.
21650  * This type name can be returned as a std::string for printing
21651  * node to text/json form.
21652  *
21653  * \return name of the node type as a string i.e. "ExpressionStatement"
21654  *
21655  * \sa Ast::get_node_name
21656  */
21657  std::string get_node_type_name() const noexcept override {
21658  return "ExpressionStatement";
21659  }
21660 
21661  /**
21662  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21663  */
21664  std::shared_ptr<Ast> get_shared_ptr() override {
21665  return std::static_pointer_cast<ExpressionStatement>(shared_from_this());
21666  }
21667 
21668  /**
21669  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21670  */
21671  std::shared_ptr<const Ast> get_shared_ptr() const override {
21672  return std::static_pointer_cast<const ExpressionStatement>(
21673  shared_from_this());
21674  }
21675 
21676  /**
21677  * \brief Return associated token for the current ast node
21678  *
21679  * Not all ast nodes have token information. For example,
21680  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
21681  * solution of ODEs. In this case, we return nullptr to store in the
21682  * nmodl::symtab::SymbolTable.
21683  *
21684  * \return pointer to token if exist otherwise nullptr
21685  */
21686  const ModToken *get_token() const noexcept override { return token.get(); }
21687 
21688  /**
21689  * \brief Getter for member variable \ref ExpressionStatement.expression
21690  */
21691  const std::shared_ptr<Expression> &get_expression() const noexcept {
21692  return expression;
21693  }
21694 
21695  /// \}
21696 
21697  /// \name Setters
21698  /// \{
21699 
21700  /**
21701  * \brief Set token for the current ast node
21702  */
21703  void set_token(const ModToken &tok) {
21704  token = std::make_shared<ModToken>(tok);
21705  }
21706 
21707  /**
21708  * \brief Setter for member variable \ref ExpressionStatement.expression
21709  * (rvalue reference)
21710  */
21711  void set_expression(std::shared_ptr<Expression> &&expression);
21712 
21713  /**
21714  * \brief Setter for member variable \ref ExpressionStatement.expression
21715  */
21716  void set_expression(const std::shared_ptr<Expression> &expression);
21717 
21718  /// \}
21719 
21720  /// \name Visitor
21721  /// \{
21722 
21723  /**
21724  * \brief visit children i.e. member variables of current node using provided
21725  * visitor
21726  *
21727  * Different nodes in the AST have different members (i.e. children). This
21728  * method recursively visits children using provided visitor.
21729  *
21730  * \param v Concrete visitor that will be used to recursively visit children
21731  *
21732  * \sa Ast::visit_children for example.
21733  */
21734  void visit_children(visitor::Visitor &v) override;
21735 
21736  /**
21737  * \brief accept (or visit) the current AST node using provided visitor
21738  *
21739  * Instead of visiting children of AST node, like Ast::visit_children,
21740  * accept allows to visit the current node itself using provided concrete
21741  * visitor.
21742  *
21743  * \param v Concrete visitor that will be used to recursively visit node
21744  *
21745  * \sa Ast::accept for example.
21746  */
21747  void accept(visitor::Visitor &v) override;
21748 
21749  /// \}
21750 
21751 private:
21752  /**
21753  * \brief Set this object as parent for all the children
21754  *
21755  * This should be called in every object (with children) constructor
21756  * to set parents. Since it is called only in the constructors it
21757  * should not be virtual to avoid ambiguities (issue #295).
21758  */
21759  void set_parent_in_children();
21760 };
21761 
21762 /** @} */ // end of ast_class
21763 
21764 } // namespace ast
21765 } // namespace nmodl
21766 #endif // !NMODL_AST_EXPRESSION_STATEMENT_HPP
21767 #ifndef NMODL_AST_PROTECT_STATEMENT_HPP
21768 #define NMODL_AST_PROTECT_STATEMENT_HPP
21769 
21770 namespace nmodl {
21771 namespace ast {
21772 
21773 /**
21774  * @addtogroup ast_class
21775  * @ingroup ast
21776  * @{
21777  */
21778 
21779 /**
21780  * \brief TODO
21781  *
21782  *
21783  */
21784 class ProtectStatement : public Statement {
21785 private:
21786  /// TODO
21787  std::shared_ptr<Expression> expression;
21788  /// token with location information
21789  std::shared_ptr<ModToken> token;
21790 
21791 public:
21792  /// \name Ctor & dtor
21793  /// \{
21794 
21795  explicit ProtectStatement(Expression *expression);
21796  explicit ProtectStatement(const std::shared_ptr<Expression> &expression);
21797  ProtectStatement(const ProtectStatement &obj);
21798 
21799  virtual ~ProtectStatement() = default;
21800 
21801  /// \}
21802 
21803  /**
21804  * \brief Check if the ast node is an instance of ast::ProtectStatement
21805  * \return true as object is of type ast::ProtectStatement
21806  */
21807  bool is_protect_statement() const noexcept override { return true; }
21808 
21809  /**
21810  * \brief Return a copy of the current node
21811  *
21812  * Recursively make a new copy/clone of the current node including
21813  * all members and return a pointer to the node. This is used for
21814  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21815  * ast.
21816  *
21817  * @return pointer to the clone/copy of the current node
21818  */
21819  ProtectStatement *clone() const override {
21820  return new ProtectStatement(*this);
21821  }
21822 
21823  /// \name Getters
21824  /// \{
21825 
21826  /**
21827  * \brief Return type (ast::AstNodeType) of ast node
21828  *
21829  * Every node in the ast has a type defined in ast::AstNodeType and this
21830  * function is used to retrieve the same.
21831  *
21832  * \return ast node type i.e. ast::AstNodeType::PROTECT_STATEMENT
21833  *
21834  * \sa Ast::get_node_type_name
21835  */
21836  AstNodeType get_node_type() const noexcept override {
21838  }
21839 
21840  /**
21841  * \brief Return type (ast::AstNodeType) of ast node as std::string
21842  *
21843  * Every node in the ast has a type defined in ast::AstNodeType.
21844  * This type name can be returned as a std::string for printing
21845  * node to text/json form.
21846  *
21847  * \return name of the node type as a string i.e. "ProtectStatement"
21848  *
21849  * \sa Ast::get_node_name
21850  */
21851  std::string get_node_type_name() const noexcept override {
21852  return "ProtectStatement";
21853  }
21854 
21855  /**
21856  * \brief Return NMODL statement of ast node as std::string
21857  *
21858  * Every node is related to a special statement in the NMODL. This
21859  * statement can be returned as a std::string for printing to
21860  * text/json form.
21861  *
21862  * \return name of the statement as a string i.e. "PROTECT "
21863  *
21864  * \sa Ast::get_nmodl_name
21865  */
21866  std::string get_nmodl_name() const noexcept override { return "PROTECT "; }
21867 
21868  /**
21869  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21870  */
21871  std::shared_ptr<Ast> get_shared_ptr() override {
21872  return std::static_pointer_cast<ProtectStatement>(shared_from_this());
21873  }
21874 
21875  /**
21876  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21877  */
21878  std::shared_ptr<const Ast> get_shared_ptr() const override {
21879  return std::static_pointer_cast<const ProtectStatement>(shared_from_this());
21880  }
21881 
21882  /**
21883  * \brief Return associated token for the current ast node
21884  *
21885  * Not all ast nodes have token information. For example,
21886  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
21887  * solution of ODEs. In this case, we return nullptr to store in the
21888  * nmodl::symtab::SymbolTable.
21889  *
21890  * \return pointer to token if exist otherwise nullptr
21891  */
21892  const ModToken *get_token() const noexcept override { return token.get(); }
21893 
21894  /**
21895  * \brief Getter for member variable \ref ProtectStatement.expression
21896  */
21897  const std::shared_ptr<Expression> &get_expression() const noexcept {
21898  return expression;
21899  }
21900 
21901  /// \}
21902 
21903  /// \name Setters
21904  /// \{
21905 
21906  /**
21907  * \brief Set token for the current ast node
21908  */
21909  void set_token(const ModToken &tok) {
21910  token = std::make_shared<ModToken>(tok);
21911  }
21912 
21913  /**
21914  * \brief Setter for member variable \ref ProtectStatement.expression (rvalue
21915  * reference)
21916  */
21917  void set_expression(std::shared_ptr<Expression> &&expression);
21918 
21919  /**
21920  * \brief Setter for member variable \ref ProtectStatement.expression
21921  */
21922  void set_expression(const std::shared_ptr<Expression> &expression);
21923 
21924  /// \}
21925 
21926  /// \name Visitor
21927  /// \{
21928 
21929  /**
21930  * \brief visit children i.e. member variables of current node using provided
21931  * visitor
21932  *
21933  * Different nodes in the AST have different members (i.e. children). This
21934  * method recursively visits children using provided visitor.
21935  *
21936  * \param v Concrete visitor that will be used to recursively visit children
21937  *
21938  * \sa Ast::visit_children for example.
21939  */
21940  void visit_children(visitor::Visitor &v) override;
21941 
21942  /**
21943  * \brief accept (or visit) the current AST node using provided visitor
21944  *
21945  * Instead of visiting children of AST node, like Ast::visit_children,
21946  * accept allows to visit the current node itself using provided concrete
21947  * visitor.
21948  *
21949  * \param v Concrete visitor that will be used to recursively visit node
21950  *
21951  * \sa Ast::accept for example.
21952  */
21953  void accept(visitor::Visitor &v) override;
21954 
21955  /// \}
21956 
21957 private:
21958  /**
21959  * \brief Set this object as parent for all the children
21960  *
21961  * This should be called in every object (with children) constructor
21962  * to set parents. Since it is called only in the constructors it
21963  * should not be virtual to avoid ambiguities (issue #295).
21964  */
21965  void set_parent_in_children();
21966 };
21967 
21968 /** @} */ // end of ast_class
21969 
21970 } // namespace ast
21971 } // namespace nmodl
21972 #endif // !NMODL_AST_PROTECT_STATEMENT_HPP
21973 #ifndef NMODL_AST_FROM_STATEMENT_HPP
21974 #define NMODL_AST_FROM_STATEMENT_HPP
21975 
21976 namespace nmodl {
21977 namespace ast {
21978 
21979 /**
21980  * @addtogroup ast_class
21981  * @ingroup ast
21982  * @{
21983  */
21984 
21985 /**
21986  * \brief TODO
21987  *
21988  *
21989  */
21990 class FromStatement : public Statement {
21991 private:
21992  /// TODO
21993  std::shared_ptr<Name> name;
21994  /// TODO
21995  std::shared_ptr<Expression> from;
21996  /// TODO
21997  std::shared_ptr<Expression> to;
21998  /// TODO
21999  std::shared_ptr<Expression> increment;
22000  /// TODO
22001  std::shared_ptr<StatementBlock> statement_block;
22002  /// token with location information
22003  std::shared_ptr<ModToken> token;
22004 
22005 public:
22006  /// \name Ctor & dtor
22007  /// \{
22008 
22009  explicit FromStatement(Name *name, Expression *from, Expression *to,
22010  Expression *increment,
22011  StatementBlock *statement_block);
22012  explicit FromStatement(
22013  const std::shared_ptr<Name> &name,
22014  const std::shared_ptr<Expression> &from,
22015  const std::shared_ptr<Expression> &to,
22016  const std::shared_ptr<Expression> &increment,
22017  const std::shared_ptr<StatementBlock> &statement_block);
22018  FromStatement(const FromStatement &obj);
22019 
22020  virtual ~FromStatement() = default;
22021 
22022  /// \}
22023 
22024  /**
22025  * \brief Check if the ast node is an instance of ast::FromStatement
22026  * \return true as object is of type ast::FromStatement
22027  */
22028  bool is_from_statement() const noexcept override { return true; }
22029 
22030  /**
22031  * \brief Return a copy of the current node
22032  *
22033  * Recursively make a new copy/clone of the current node including
22034  * all members and return a pointer to the node. This is used for
22035  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22036  * ast.
22037  *
22038  * @return pointer to the clone/copy of the current node
22039  */
22040  FromStatement *clone() const override { return new FromStatement(*this); }
22041 
22042  /// \name Getters
22043  /// \{
22044 
22045  /**
22046  * \brief Return type (ast::AstNodeType) of ast node
22047  *
22048  * Every node in the ast has a type defined in ast::AstNodeType and this
22049  * function is used to retrieve the same.
22050  *
22051  * \return ast node type i.e. ast::AstNodeType::FROM_STATEMENT
22052  *
22053  * \sa Ast::get_node_type_name
22054  */
22055  AstNodeType get_node_type() const noexcept override {
22057  }
22058 
22059  /**
22060  * \brief Return type (ast::AstNodeType) of ast node as std::string
22061  *
22062  * Every node in the ast has a type defined in ast::AstNodeType.
22063  * This type name can be returned as a std::string for printing
22064  * node to text/json form.
22065  *
22066  * \return name of the node type as a string i.e. "FromStatement"
22067  *
22068  * \sa Ast::get_node_name
22069  */
22070  std::string get_node_type_name() const noexcept override {
22071  return "FromStatement";
22072  }
22073 
22074  /**
22075  * \brief Return NMODL statement of ast node as std::string
22076  *
22077  * Every node is related to a special statement in the NMODL. This
22078  * statement can be returned as a std::string for printing to
22079  * text/json form.
22080  *
22081  * \return name of the statement as a string i.e. "FROM "
22082  *
22083  * \sa Ast::get_nmodl_name
22084  */
22085  std::string get_nmodl_name() const noexcept override { return "FROM "; }
22086 
22087  /**
22088  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22089  */
22090  std::shared_ptr<Ast> get_shared_ptr() override {
22091  return std::static_pointer_cast<FromStatement>(shared_from_this());
22092  }
22093 
22094  /**
22095  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22096  */
22097  std::shared_ptr<const Ast> get_shared_ptr() const override {
22098  return std::static_pointer_cast<const FromStatement>(shared_from_this());
22099  }
22100 
22101  /**
22102  * \brief Return associated token for the current ast node
22103  *
22104  * Not all ast nodes have token information. For example,
22105  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
22106  * solution of ODEs. In this case, we return nullptr to store in the
22107  * nmodl::symtab::SymbolTable.
22108  *
22109  * \return pointer to token if exist otherwise nullptr
22110  */
22111  const ModToken *get_token() const noexcept override { return token.get(); }
22112 
22113  /**
22114  * \brief Return name of the node
22115  *
22116  * Some ast nodes have a member marked designated as node name. For example,
22117  * in case of this ast::Name has name designated as a
22118  * node name.
22119  *
22120  * @return name of the node as std::string
22121  *
22122  * \sa Ast::get_node_type_name
22123  */
22124  std::string get_node_name() const override;
22125 
22126  /**
22127  * \brief Getter for member variable \ref FromStatement.name
22128  */
22129  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
22130 
22131  /**
22132  * \brief Getter for member variable \ref FromStatement.from
22133  */
22134  const std::shared_ptr<Expression> &get_from() const noexcept { return from; }
22135 
22136  /**
22137  * \brief Getter for member variable \ref FromStatement.to
22138  */
22139  const std::shared_ptr<Expression> &get_to() const noexcept { return to; }
22140 
22141  /**
22142  * \brief Getter for member variable \ref FromStatement.increment
22143  */
22144  const std::shared_ptr<Expression> &get_increment() const noexcept {
22145  return increment;
22146  }
22147 
22148  /**
22149  * \brief Getter for member variable \ref FromStatement.statement_block
22150  */
22151  const std::shared_ptr<StatementBlock> &get_statement_block() const
22152  noexcept override {
22153  return statement_block;
22154  }
22155 
22156  /// \}
22157 
22158  /// \name Setters
22159  /// \{
22160 
22161  /**
22162  * \brief Set token for the current ast node
22163  */
22164  void set_token(const ModToken &tok) {
22165  token = std::make_shared<ModToken>(tok);
22166  }
22167 
22168  /**
22169  * \brief Setter for member variable \ref FromStatement.name (rvalue
22170  * reference)
22171  */
22172  void set_name(std::shared_ptr<Name> &&name);
22173 
22174  /**
22175  * \brief Setter for member variable \ref FromStatement.name
22176  */
22177  void set_name(const std::shared_ptr<Name> &name);
22178 
22179  /**
22180  * \brief Setter for member variable \ref FromStatement.from (rvalue
22181  * reference)
22182  */
22183  void set_from(std::shared_ptr<Expression> &&from);
22184 
22185  /**
22186  * \brief Setter for member variable \ref FromStatement.from
22187  */
22188  void set_from(const std::shared_ptr<Expression> &from);
22189 
22190  /**
22191  * \brief Setter for member variable \ref FromStatement.to (rvalue reference)
22192  */
22193  void set_to(std::shared_ptr<Expression> &&to);
22194 
22195  /**
22196  * \brief Setter for member variable \ref FromStatement.to
22197  */
22198  void set_to(const std::shared_ptr<Expression> &to);
22199 
22200  /**
22201  * \brief Setter for member variable \ref FromStatement.increment (rvalue
22202  * reference)
22203  */
22204  void set_increment(std::shared_ptr<Expression> &&increment);
22205 
22206  /**
22207  * \brief Setter for member variable \ref FromStatement.increment
22208  */
22209  void set_increment(const std::shared_ptr<Expression> &increment);
22210 
22211  /**
22212  * \brief Setter for member variable \ref FromStatement.statement_block
22213  * (rvalue reference)
22214  */
22215  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
22216 
22217  /**
22218  * \brief Setter for member variable \ref FromStatement.statement_block
22219  */
22220  void
22221  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
22222 
22223  /// \}
22224 
22225  /// \name Visitor
22226  /// \{
22227 
22228  /**
22229  * \brief visit children i.e. member variables of current node using provided
22230  * visitor
22231  *
22232  * Different nodes in the AST have different members (i.e. children). This
22233  * method recursively visits children using provided visitor.
22234  *
22235  * \param v Concrete visitor that will be used to recursively visit children
22236  *
22237  * \sa Ast::visit_children for example.
22238  */
22239  void visit_children(visitor::Visitor &v) override;
22240 
22241  /**
22242  * \brief accept (or visit) the current AST node using provided visitor
22243  *
22244  * Instead of visiting children of AST node, like Ast::visit_children,
22245  * accept allows to visit the current node itself using provided concrete
22246  * visitor.
22247  *
22248  * \param v Concrete visitor that will be used to recursively visit node
22249  *
22250  * \sa Ast::accept for example.
22251  */
22252  void accept(visitor::Visitor &v) override;
22253 
22254  /// \}
22255 
22256 private:
22257  /**
22258  * \brief Set this object as parent for all the children
22259  *
22260  * This should be called in every object (with children) constructor
22261  * to set parents. Since it is called only in the constructors it
22262  * should not be virtual to avoid ambiguities (issue #295).
22263  */
22264  void set_parent_in_children();
22265 };
22266 
22267 /** @} */ // end of ast_class
22268 
22269 } // namespace ast
22270 } // namespace nmodl
22271 #endif // !NMODL_AST_FROM_STATEMENT_HPP
22272 #ifndef NMODL_AST_FOR_ALL_STATEMENT_HPP
22273 #define NMODL_AST_FOR_ALL_STATEMENT_HPP
22274 
22275 namespace nmodl {
22276 namespace ast {
22277 
22278 /**
22279  * @addtogroup ast_class
22280  * @ingroup ast
22281  * @{
22282  */
22283 
22284 /**
22285  * \brief TODO
22286  *
22287  *
22288  */
22289 class ForAllStatement : public Statement {
22290 private:
22291  /// TODO
22292  std::shared_ptr<Name> name;
22293  /// TODO
22294  std::shared_ptr<StatementBlock> statement_block;
22295  /// token with location information
22296  std::shared_ptr<ModToken> token;
22297 
22298 public:
22299  /// \name Ctor & dtor
22300  /// \{
22301 
22302  explicit ForAllStatement(Name *name, StatementBlock *statement_block);
22303  explicit ForAllStatement(
22304  const std::shared_ptr<Name> &name,
22305  const std::shared_ptr<StatementBlock> &statement_block);
22306  ForAllStatement(const ForAllStatement &obj);
22307 
22308  virtual ~ForAllStatement() = default;
22309 
22310  /// \}
22311 
22312  /**
22313  * \brief Check if the ast node is an instance of ast::ForAllStatement
22314  * \return true as object is of type ast::ForAllStatement
22315  */
22316  bool is_for_all_statement() const noexcept override { return true; }
22317 
22318  /**
22319  * \brief Return a copy of the current node
22320  *
22321  * Recursively make a new copy/clone of the current node including
22322  * all members and return a pointer to the node. This is used for
22323  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22324  * ast.
22325  *
22326  * @return pointer to the clone/copy of the current node
22327  */
22328  ForAllStatement *clone() const override { return new ForAllStatement(*this); }
22329 
22330  /// \name Getters
22331  /// \{
22332 
22333  /**
22334  * \brief Return type (ast::AstNodeType) of ast node
22335  *
22336  * Every node in the ast has a type defined in ast::AstNodeType and this
22337  * function is used to retrieve the same.
22338  *
22339  * \return ast node type i.e. ast::AstNodeType::FOR_ALL_STATEMENT
22340  *
22341  * \sa Ast::get_node_type_name
22342  */
22343  AstNodeType get_node_type() const noexcept override {
22345  }
22346 
22347  /**
22348  * \brief Return type (ast::AstNodeType) of ast node as std::string
22349  *
22350  * Every node in the ast has a type defined in ast::AstNodeType.
22351  * This type name can be returned as a std::string for printing
22352  * node to text/json form.
22353  *
22354  * \return name of the node type as a string i.e. "ForAllStatement"
22355  *
22356  * \sa Ast::get_node_name
22357  */
22358  std::string get_node_type_name() const noexcept override {
22359  return "ForAllStatement";
22360  }
22361 
22362  /**
22363  * \brief Return NMODL statement of ast node as std::string
22364  *
22365  * Every node is related to a special statement in the NMODL. This
22366  * statement can be returned as a std::string for printing to
22367  * text/json form.
22368  *
22369  * \return name of the statement as a string i.e. "FORALL "
22370  *
22371  * \sa Ast::get_nmodl_name
22372  */
22373  std::string get_nmodl_name() const noexcept override { return "FORALL "; }
22374 
22375  /**
22376  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22377  */
22378  std::shared_ptr<Ast> get_shared_ptr() override {
22379  return std::static_pointer_cast<ForAllStatement>(shared_from_this());
22380  }
22381 
22382  /**
22383  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22384  */
22385  std::shared_ptr<const Ast> get_shared_ptr() const override {
22386  return std::static_pointer_cast<const ForAllStatement>(shared_from_this());
22387  }
22388 
22389  /**
22390  * \brief Return associated token for the current ast node
22391  *
22392  * Not all ast nodes have token information. For example,
22393  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
22394  * solution of ODEs. In this case, we return nullptr to store in the
22395  * nmodl::symtab::SymbolTable.
22396  *
22397  * \return pointer to token if exist otherwise nullptr
22398  */
22399  const ModToken *get_token() const noexcept override { return token.get(); }
22400 
22401  /**
22402  * \brief Getter for member variable \ref ForAllStatement.name
22403  */
22404  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
22405 
22406  /**
22407  * \brief Getter for member variable \ref ForAllStatement.statement_block
22408  */
22409  const std::shared_ptr<StatementBlock> &get_statement_block() const
22410  noexcept override {
22411  return statement_block;
22412  }
22413 
22414  /// \}
22415 
22416  /// \name Setters
22417  /// \{
22418 
22419  /**
22420  * \brief Set token for the current ast node
22421  */
22422  void set_token(const ModToken &tok) {
22423  token = std::make_shared<ModToken>(tok);
22424  }
22425 
22426  /**
22427  * \brief Setter for member variable \ref ForAllStatement.name (rvalue
22428  * reference)
22429  */
22430  void set_name(std::shared_ptr<Name> &&name);
22431 
22432  /**
22433  * \brief Setter for member variable \ref ForAllStatement.name
22434  */
22435  void set_name(const std::shared_ptr<Name> &name);
22436 
22437  /**
22438  * \brief Setter for member variable \ref ForAllStatement.statement_block
22439  * (rvalue reference)
22440  */
22441  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
22442 
22443  /**
22444  * \brief Setter for member variable \ref ForAllStatement.statement_block
22445  */
22446  void
22447  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
22448 
22449  /// \}
22450 
22451  /// \name Visitor
22452  /// \{
22453 
22454  /**
22455  * \brief visit children i.e. member variables of current node using provided
22456  * visitor
22457  *
22458  * Different nodes in the AST have different members (i.e. children). This
22459  * method recursively visits children using provided visitor.
22460  *
22461  * \param v Concrete visitor that will be used to recursively visit children
22462  *
22463  * \sa Ast::visit_children for example.
22464  */
22465  void visit_children(visitor::Visitor &v) override;
22466 
22467  /**
22468  * \brief accept (or visit) the current AST node using provided visitor
22469  *
22470  * Instead of visiting children of AST node, like Ast::visit_children,
22471  * accept allows to visit the current node itself using provided concrete
22472  * visitor.
22473  *
22474  * \param v Concrete visitor that will be used to recursively visit node
22475  *
22476  * \sa Ast::accept for example.
22477  */
22478  void accept(visitor::Visitor &v) override;
22479 
22480  /// \}
22481 
22482 private:
22483  /**
22484  * \brief Set this object as parent for all the children
22485  *
22486  * This should be called in every object (with children) constructor
22487  * to set parents. Since it is called only in the constructors it
22488  * should not be virtual to avoid ambiguities (issue #295).
22489  */
22490  void set_parent_in_children();
22491 };
22492 
22493 /** @} */ // end of ast_class
22494 
22495 } // namespace ast
22496 } // namespace nmodl
22497 #endif // !NMODL_AST_FOR_ALL_STATEMENT_HPP
22498 #ifndef NMODL_AST_WHILE_STATEMENT_HPP
22499 #define NMODL_AST_WHILE_STATEMENT_HPP
22500 
22501 namespace nmodl {
22502 namespace ast {
22503 
22504 /**
22505  * @addtogroup ast_class
22506  * @ingroup ast
22507  * @{
22508  */
22509 
22510 /**
22511  * \brief TODO
22512  *
22513  *
22514  */
22515 class WhileStatement : public Statement {
22516 private:
22517  /// TODO
22518  std::shared_ptr<Expression> condition;
22519  /// TODO
22520  std::shared_ptr<StatementBlock> statement_block;
22521  /// token with location information
22522  std::shared_ptr<ModToken> token;
22523 
22524 public:
22525  /// \name Ctor & dtor
22526  /// \{
22527 
22528  explicit WhileStatement(Expression *condition,
22529  StatementBlock *statement_block);
22530  explicit WhileStatement(
22531  const std::shared_ptr<Expression> &condition,
22532  const std::shared_ptr<StatementBlock> &statement_block);
22533  WhileStatement(const WhileStatement &obj);
22534 
22535  virtual ~WhileStatement() = default;
22536 
22537  /// \}
22538 
22539  /**
22540  * \brief Check if the ast node is an instance of ast::WhileStatement
22541  * \return true as object is of type ast::WhileStatement
22542  */
22543  bool is_while_statement() const noexcept override { return true; }
22544 
22545  /**
22546  * \brief Return a copy of the current node
22547  *
22548  * Recursively make a new copy/clone of the current node including
22549  * all members and return a pointer to the node. This is used for
22550  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22551  * ast.
22552  *
22553  * @return pointer to the clone/copy of the current node
22554  */
22555  WhileStatement *clone() const override { return new WhileStatement(*this); }
22556 
22557  /// \name Getters
22558  /// \{
22559 
22560  /**
22561  * \brief Return type (ast::AstNodeType) of ast node
22562  *
22563  * Every node in the ast has a type defined in ast::AstNodeType and this
22564  * function is used to retrieve the same.
22565  *
22566  * \return ast node type i.e. ast::AstNodeType::WHILE_STATEMENT
22567  *
22568  * \sa Ast::get_node_type_name
22569  */
22570  AstNodeType get_node_type() const noexcept override {
22572  }
22573 
22574  /**
22575  * \brief Return type (ast::AstNodeType) of ast node as std::string
22576  *
22577  * Every node in the ast has a type defined in ast::AstNodeType.
22578  * This type name can be returned as a std::string for printing
22579  * node to text/json form.
22580  *
22581  * \return name of the node type as a string i.e. "WhileStatement"
22582  *
22583  * \sa Ast::get_node_name
22584  */
22585  std::string get_node_type_name() const noexcept override {
22586  return "WhileStatement";
22587  }
22588 
22589  /**
22590  * \brief Return NMODL statement of ast node as std::string
22591  *
22592  * Every node is related to a special statement in the NMODL. This
22593  * statement can be returned as a std::string for printing to
22594  * text/json form.
22595  *
22596  * \return name of the statement as a string i.e. "WHILE "
22597  *
22598  * \sa Ast::get_nmodl_name
22599  */
22600  std::string get_nmodl_name() const noexcept override { return "WHILE "; }
22601 
22602  /**
22603  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22604  */
22605  std::shared_ptr<Ast> get_shared_ptr() override {
22606  return std::static_pointer_cast<WhileStatement>(shared_from_this());
22607  }
22608 
22609  /**
22610  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22611  */
22612  std::shared_ptr<const Ast> get_shared_ptr() const override {
22613  return std::static_pointer_cast<const WhileStatement>(shared_from_this());
22614  }
22615 
22616  /**
22617  * \brief Return associated token for the current ast node
22618  *
22619  * Not all ast nodes have token information. For example,
22620  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
22621  * solution of ODEs. In this case, we return nullptr to store in the
22622  * nmodl::symtab::SymbolTable.
22623  *
22624  * \return pointer to token if exist otherwise nullptr
22625  */
22626  const ModToken *get_token() const noexcept override { return token.get(); }
22627 
22628  /**
22629  * \brief Getter for member variable \ref WhileStatement.condition
22630  */
22631  const std::shared_ptr<Expression> &get_condition() const noexcept {
22632  return condition;
22633  }
22634 
22635  /**
22636  * \brief Getter for member variable \ref WhileStatement.statement_block
22637  */
22638  const std::shared_ptr<StatementBlock> &get_statement_block() const
22639  noexcept override {
22640  return statement_block;
22641  }
22642 
22643  /// \}
22644 
22645  /// \name Setters
22646  /// \{
22647 
22648  /**
22649  * \brief Set token for the current ast node
22650  */
22651  void set_token(const ModToken &tok) {
22652  token = std::make_shared<ModToken>(tok);
22653  }
22654 
22655  /**
22656  * \brief Setter for member variable \ref WhileStatement.condition (rvalue
22657  * reference)
22658  */
22659  void set_condition(std::shared_ptr<Expression> &&condition);
22660 
22661  /**
22662  * \brief Setter for member variable \ref WhileStatement.condition
22663  */
22664  void set_condition(const std::shared_ptr<Expression> &condition);
22665 
22666  /**
22667  * \brief Setter for member variable \ref WhileStatement.statement_block
22668  * (rvalue reference)
22669  */
22670  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
22671 
22672  /**
22673  * \brief Setter for member variable \ref WhileStatement.statement_block
22674  */
22675  void
22676  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
22677 
22678  /// \}
22679 
22680  /// \name Visitor
22681  /// \{
22682 
22683  /**
22684  * \brief visit children i.e. member variables of current node using provided
22685  * visitor
22686  *
22687  * Different nodes in the AST have different members (i.e. children). This
22688  * method recursively visits children using provided visitor.
22689  *
22690  * \param v Concrete visitor that will be used to recursively visit children
22691  *
22692  * \sa Ast::visit_children for example.
22693  */
22694  void visit_children(visitor::Visitor &v) override;
22695 
22696  /**
22697  * \brief accept (or visit) the current AST node using provided visitor
22698  *
22699  * Instead of visiting children of AST node, like Ast::visit_children,
22700  * accept allows to visit the current node itself using provided concrete
22701  * visitor.
22702  *
22703  * \param v Concrete visitor that will be used to recursively visit node
22704  *
22705  * \sa Ast::accept for example.
22706  */
22707  void accept(visitor::Visitor &v) override;
22708 
22709  /// \}
22710 
22711 private:
22712  /**
22713  * \brief Set this object as parent for all the children
22714  *
22715  * This should be called in every object (with children) constructor
22716  * to set parents. Since it is called only in the constructors it
22717  * should not be virtual to avoid ambiguities (issue #295).
22718  */
22719  void set_parent_in_children();
22720 };
22721 
22722 /** @} */ // end of ast_class
22723 
22724 } // namespace ast
22725 } // namespace nmodl
22726 #endif // !NMODL_AST_WHILE_STATEMENT_HPP
22727 #ifndef NMODL_AST_IF_STATEMENT_HPP
22728 #define NMODL_AST_IF_STATEMENT_HPP
22729 
22730 namespace nmodl {
22731 namespace ast {
22732 
22733 /**
22734  * @addtogroup ast_class
22735  * @ingroup ast
22736  * @{
22737  */
22738 
22739 /**
22740  * \brief TODO
22741  *
22742  *
22743  */
22744 class IfStatement : public Statement {
22745 private:
22746  /// TODO
22747  std::shared_ptr<Expression> condition;
22748  /// TODO
22749  std::shared_ptr<StatementBlock> statement_block;
22750  /// TODO
22752  /// TODO
22753  std::shared_ptr<ElseStatement> elses;
22754  /// token with location information
22755  std::shared_ptr<ModToken> token;
22756 
22757 public:
22758  /// \name Ctor & dtor
22759  /// \{
22760 
22761  explicit IfStatement(Expression *condition, StatementBlock *statement_block,
22762  ElseIfStatementVector elseifs, ElseStatement *elses);
22763  explicit IfStatement(const std::shared_ptr<Expression> &condition,
22764  const std::shared_ptr<StatementBlock> &statement_block,
22765  const ElseIfStatementVector &elseifs,
22766  const std::shared_ptr<ElseStatement> &elses);
22767  IfStatement(const IfStatement &obj);
22768 
22769  virtual ~IfStatement() = default;
22770 
22771  /// \}
22772 
22773  /**
22774  * \brief Check if the ast node is an instance of ast::IfStatement
22775  * \return true as object is of type ast::IfStatement
22776  */
22777  bool is_if_statement() const noexcept override { return true; }
22778 
22779  /**
22780  * \brief Return a copy of the current node
22781  *
22782  * Recursively make a new copy/clone of the current node including
22783  * all members and return a pointer to the node. This is used for
22784  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22785  * ast.
22786  *
22787  * @return pointer to the clone/copy of the current node
22788  */
22789  IfStatement *clone() const override { return new IfStatement(*this); }
22790 
22791  /// \name Getters
22792  /// \{
22793 
22794  /**
22795  * \brief Return type (ast::AstNodeType) of ast node
22796  *
22797  * Every node in the ast has a type defined in ast::AstNodeType and this
22798  * function is used to retrieve the same.
22799  *
22800  * \return ast node type i.e. ast::AstNodeType::IF_STATEMENT
22801  *
22802  * \sa Ast::get_node_type_name
22803  */
22804  AstNodeType get_node_type() const noexcept override {
22806  }
22807 
22808  /**
22809  * \brief Return type (ast::AstNodeType) of ast node as std::string
22810  *
22811  * Every node in the ast has a type defined in ast::AstNodeType.
22812  * This type name can be returned as a std::string for printing
22813  * node to text/json form.
22814  *
22815  * \return name of the node type as a string i.e. "IfStatement"
22816  *
22817  * \sa Ast::get_node_name
22818  */
22819  std::string get_node_type_name() const noexcept override {
22820  return "IfStatement";
22821  }
22822 
22823  /**
22824  * \brief Return NMODL statement of ast node as std::string
22825  *
22826  * Every node is related to a special statement in the NMODL. This
22827  * statement can be returned as a std::string for printing to
22828  * text/json form.
22829  *
22830  * \return name of the statement as a string i.e. "IF "
22831  *
22832  * \sa Ast::get_nmodl_name
22833  */
22834  std::string get_nmodl_name() const noexcept override { return "IF "; }
22835 
22836  /**
22837  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22838  */
22839  std::shared_ptr<Ast> get_shared_ptr() override {
22840  return std::static_pointer_cast<IfStatement>(shared_from_this());
22841  }
22842 
22843  /**
22844  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22845  */
22846  std::shared_ptr<const Ast> get_shared_ptr() const override {
22847  return std::static_pointer_cast<const IfStatement>(shared_from_this());
22848  }
22849 
22850  /**
22851  * \brief Return associated token for the current ast node
22852  *
22853  * Not all ast nodes have token information. For example,
22854  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
22855  * solution of ODEs. In this case, we return nullptr to store in the
22856  * nmodl::symtab::SymbolTable.
22857  *
22858  * \return pointer to token if exist otherwise nullptr
22859  */
22860  const ModToken *get_token() const noexcept override { return token.get(); }
22861 
22862  /**
22863  * \brief Getter for member variable \ref IfStatement.condition
22864  */
22865  const std::shared_ptr<Expression> &get_condition() const noexcept {
22866  return condition;
22867  }
22868 
22869  /**
22870  * \brief Getter for member variable \ref IfStatement.statement_block
22871  */
22872  const std::shared_ptr<StatementBlock> &get_statement_block() const
22873  noexcept override {
22874  return statement_block;
22875  }
22876 
22877  /**
22878  * \brief Getter for member variable \ref IfStatement.elseifs
22879  */
22880  const ElseIfStatementVector &get_elseifs() const noexcept { return elseifs; }
22881 
22882  /**
22883  * \brief Getter for member variable \ref IfStatement.elses
22884  */
22885  const std::shared_ptr<ElseStatement> &get_elses() const noexcept {
22886  return elses;
22887  }
22888 
22889  /// \}
22890 
22891  /// \name Setters
22892  /// \{
22893 
22894  /**
22895  * \brief Set token for the current ast node
22896  */
22897  void set_token(const ModToken &tok) {
22898  token = std::make_shared<ModToken>(tok);
22899  }
22900 
22901  /**
22902  * \brief Setter for member variable \ref IfStatement.condition (rvalue
22903  * reference)
22904  */
22905  void set_condition(std::shared_ptr<Expression> &&condition);
22906 
22907  /**
22908  * \brief Setter for member variable \ref IfStatement.condition
22909  */
22910  void set_condition(const std::shared_ptr<Expression> &condition);
22911 
22912  /**
22913  * \brief Setter for member variable \ref IfStatement.statement_block (rvalue
22914  * reference)
22915  */
22916  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
22917 
22918  /**
22919  * \brief Setter for member variable \ref IfStatement.statement_block
22920  */
22921  void
22922  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
22923 
22924  /**
22925  * \brief Setter for member variable \ref IfStatement.elseifs (rvalue
22926  * reference)
22927  */
22928  void set_elseifs(ElseIfStatementVector &&elseifs);
22929 
22930  /**
22931  * \brief Setter for member variable \ref IfStatement.elseifs
22932  */
22933  void set_elseifs(const ElseIfStatementVector &elseifs);
22934 
22935  /**
22936  * \brief Setter for member variable \ref IfStatement.elses (rvalue reference)
22937  */
22938  void set_elses(std::shared_ptr<ElseStatement> &&elses);
22939 
22940  /**
22941  * \brief Setter for member variable \ref IfStatement.elses
22942  */
22943  void set_elses(const std::shared_ptr<ElseStatement> &elses);
22944 
22945  /// \}
22946 
22947  /// \name Visitor
22948  /// \{
22949 
22950  /**
22951  * \brief visit children i.e. member variables of current node using provided
22952  * visitor
22953  *
22954  * Different nodes in the AST have different members (i.e. children). This
22955  * method recursively visits children using provided visitor.
22956  *
22957  * \param v Concrete visitor that will be used to recursively visit children
22958  *
22959  * \sa Ast::visit_children for example.
22960  */
22961  void visit_children(visitor::Visitor &v) override;
22962 
22963  /**
22964  * \brief accept (or visit) the current AST node using provided visitor
22965  *
22966  * Instead of visiting children of AST node, like Ast::visit_children,
22967  * accept allows to visit the current node itself using provided concrete
22968  * visitor.
22969  *
22970  * \param v Concrete visitor that will be used to recursively visit node
22971  *
22972  * \sa Ast::accept for example.
22973  */
22974  void accept(visitor::Visitor &v) override;
22975 
22976  /// \}
22977 
22978 private:
22979  /**
22980  * \brief Set this object as parent for all the children
22981  *
22982  * This should be called in every object (with children) constructor
22983  * to set parents. Since it is called only in the constructors it
22984  * should not be virtual to avoid ambiguities (issue #295).
22985  */
22986  void set_parent_in_children();
22987 };
22988 
22989 /** @} */ // end of ast_class
22990 
22991 } // namespace ast
22992 } // namespace nmodl
22993 #endif // !NMODL_AST_IF_STATEMENT_HPP
22994 #ifndef NMODL_AST_ELSE_IF_STATEMENT_HPP
22995 #define NMODL_AST_ELSE_IF_STATEMENT_HPP
22996 
22997 namespace nmodl {
22998 namespace ast {
22999 
23000 /**
23001  * @addtogroup ast_class
23002  * @ingroup ast
23003  * @{
23004  */
23005 
23006 /**
23007  * \brief TODO
23008  *
23009  *
23010  */
23011 class ElseIfStatement : public Statement {
23012 private:
23013  /// TODO
23014  std::shared_ptr<Expression> condition;
23015  /// TODO
23016  std::shared_ptr<StatementBlock> statement_block;
23017  /// token with location information
23018  std::shared_ptr<ModToken> token;
23019 
23020 public:
23021  /// \name Ctor & dtor
23022  /// \{
23023 
23024  explicit ElseIfStatement(Expression *condition,
23025  StatementBlock *statement_block);
23026  explicit ElseIfStatement(
23027  const std::shared_ptr<Expression> &condition,
23028  const std::shared_ptr<StatementBlock> &statement_block);
23029  ElseIfStatement(const ElseIfStatement &obj);
23030 
23031  virtual ~ElseIfStatement() = default;
23032 
23033  /// \}
23034 
23035  /**
23036  * \brief Check if the ast node is an instance of ast::ElseIfStatement
23037  * \return true as object is of type ast::ElseIfStatement
23038  */
23039  bool is_else_if_statement() const noexcept override { return true; }
23040 
23041  /**
23042  * \brief Return a copy of the current node
23043  *
23044  * Recursively make a new copy/clone of the current node including
23045  * all members and return a pointer to the node. This is used for
23046  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23047  * ast.
23048  *
23049  * @return pointer to the clone/copy of the current node
23050  */
23051  ElseIfStatement *clone() const override { return new ElseIfStatement(*this); }
23052 
23053  /// \name Getters
23054  /// \{
23055 
23056  /**
23057  * \brief Return type (ast::AstNodeType) of ast node
23058  *
23059  * Every node in the ast has a type defined in ast::AstNodeType and this
23060  * function is used to retrieve the same.
23061  *
23062  * \return ast node type i.e. ast::AstNodeType::ELSE_IF_STATEMENT
23063  *
23064  * \sa Ast::get_node_type_name
23065  */
23066  AstNodeType get_node_type() const noexcept override {
23068  }
23069 
23070  /**
23071  * \brief Return type (ast::AstNodeType) of ast node as std::string
23072  *
23073  * Every node in the ast has a type defined in ast::AstNodeType.
23074  * This type name can be returned as a std::string for printing
23075  * node to text/json form.
23076  *
23077  * \return name of the node type as a string i.e. "ElseIfStatement"
23078  *
23079  * \sa Ast::get_node_name
23080  */
23081  std::string get_node_type_name() const noexcept override {
23082  return "ElseIfStatement";
23083  }
23084 
23085  /**
23086  * \brief Return NMODL statement of ast node as std::string
23087  *
23088  * Every node is related to a special statement in the NMODL. This
23089  * statement can be returned as a std::string for printing to
23090  * text/json form.
23091  *
23092  * \return name of the statement as a string i.e. " ELSE IF "
23093  *
23094  * \sa Ast::get_nmodl_name
23095  */
23096  std::string get_nmodl_name() const noexcept override { return " ELSE IF "; }
23097 
23098  /**
23099  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23100  */
23101  std::shared_ptr<Ast> get_shared_ptr() override {
23102  return std::static_pointer_cast<ElseIfStatement>(shared_from_this());
23103  }
23104 
23105  /**
23106  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23107  */
23108  std::shared_ptr<const Ast> get_shared_ptr() const override {
23109  return std::static_pointer_cast<const ElseIfStatement>(shared_from_this());
23110  }
23111 
23112  /**
23113  * \brief Return associated token for the current ast node
23114  *
23115  * Not all ast nodes have token information. For example,
23116  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
23117  * solution of ODEs. In this case, we return nullptr to store in the
23118  * nmodl::symtab::SymbolTable.
23119  *
23120  * \return pointer to token if exist otherwise nullptr
23121  */
23122  const ModToken *get_token() const noexcept override { return token.get(); }
23123 
23124  /**
23125  * \brief Getter for member variable \ref ElseIfStatement.condition
23126  */
23127  const std::shared_ptr<Expression> &get_condition() const noexcept {
23128  return condition;
23129  }
23130 
23131  /**
23132  * \brief Getter for member variable \ref ElseIfStatement.statement_block
23133  */
23134  const std::shared_ptr<StatementBlock> &get_statement_block() const
23135  noexcept override {
23136  return statement_block;
23137  }
23138 
23139  /// \}
23140 
23141  /// \name Setters
23142  /// \{
23143 
23144  /**
23145  * \brief Set token for the current ast node
23146  */
23147  void set_token(const ModToken &tok) {
23148  token = std::make_shared<ModToken>(tok);
23149  }
23150 
23151  /**
23152  * \brief Setter for member variable \ref ElseIfStatement.condition (rvalue
23153  * reference)
23154  */
23155  void set_condition(std::shared_ptr<Expression> &&condition);
23156 
23157  /**
23158  * \brief Setter for member variable \ref ElseIfStatement.condition
23159  */
23160  void set_condition(const std::shared_ptr<Expression> &condition);
23161 
23162  /**
23163  * \brief Setter for member variable \ref ElseIfStatement.statement_block
23164  * (rvalue reference)
23165  */
23166  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
23167 
23168  /**
23169  * \brief Setter for member variable \ref ElseIfStatement.statement_block
23170  */
23171  void
23172  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
23173 
23174  /// \}
23175 
23176  /// \name Visitor
23177  /// \{
23178 
23179  /**
23180  * \brief visit children i.e. member variables of current node using provided
23181  * visitor
23182  *
23183  * Different nodes in the AST have different members (i.e. children). This
23184  * method recursively visits children using provided visitor.
23185  *
23186  * \param v Concrete visitor that will be used to recursively visit children
23187  *
23188  * \sa Ast::visit_children for example.
23189  */
23190  void visit_children(visitor::Visitor &v) override;
23191 
23192  /**
23193  * \brief accept (or visit) the current AST node using provided visitor
23194  *
23195  * Instead of visiting children of AST node, like Ast::visit_children,
23196  * accept allows to visit the current node itself using provided concrete
23197  * visitor.
23198  *
23199  * \param v Concrete visitor that will be used to recursively visit node
23200  *
23201  * \sa Ast::accept for example.
23202  */
23203  void accept(visitor::Visitor &v) override;
23204 
23205  /// \}
23206 
23207 private:
23208  /**
23209  * \brief Set this object as parent for all the children
23210  *
23211  * This should be called in every object (with children) constructor
23212  * to set parents. Since it is called only in the constructors it
23213  * should not be virtual to avoid ambiguities (issue #295).
23214  */
23215  void set_parent_in_children();
23216 };
23217 
23218 /** @} */ // end of ast_class
23219 
23220 } // namespace ast
23221 } // namespace nmodl
23222 #endif // !NMODL_AST_ELSE_IF_STATEMENT_HPP
23223 #ifndef NMODL_AST_ELSE_STATEMENT_HPP
23224 #define NMODL_AST_ELSE_STATEMENT_HPP
23225 
23226 namespace nmodl {
23227 namespace ast {
23228 
23229 /**
23230  * @addtogroup ast_class
23231  * @ingroup ast
23232  * @{
23233  */
23234 
23235 /**
23236  * \brief TODO
23237  *
23238  *
23239  */
23240 class ElseStatement : public Statement {
23241 private:
23242  /// TODO
23243  std::shared_ptr<StatementBlock> statement_block;
23244  /// token with location information
23245  std::shared_ptr<ModToken> token;
23246 
23247 public:
23248  /// \name Ctor & dtor
23249  /// \{
23250 
23251  explicit ElseStatement(StatementBlock *statement_block);
23252  explicit ElseStatement(
23253  const std::shared_ptr<StatementBlock> &statement_block);
23254  ElseStatement(const ElseStatement &obj);
23255 
23256  virtual ~ElseStatement() = default;
23257 
23258  /// \}
23259 
23260  /**
23261  * \brief Check if the ast node is an instance of ast::ElseStatement
23262  * \return true as object is of type ast::ElseStatement
23263  */
23264  bool is_else_statement() const noexcept override { return true; }
23265 
23266  /**
23267  * \brief Return a copy of the current node
23268  *
23269  * Recursively make a new copy/clone of the current node including
23270  * all members and return a pointer to the node. This is used for
23271  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23272  * ast.
23273  *
23274  * @return pointer to the clone/copy of the current node
23275  */
23276  ElseStatement *clone() const override { return new ElseStatement(*this); }
23277 
23278  /// \name Getters
23279  /// \{
23280 
23281  /**
23282  * \brief Return type (ast::AstNodeType) of ast node
23283  *
23284  * Every node in the ast has a type defined in ast::AstNodeType and this
23285  * function is used to retrieve the same.
23286  *
23287  * \return ast node type i.e. ast::AstNodeType::ELSE_STATEMENT
23288  *
23289  * \sa Ast::get_node_type_name
23290  */
23291  AstNodeType get_node_type() const noexcept override {
23293  }
23294 
23295  /**
23296  * \brief Return type (ast::AstNodeType) of ast node as std::string
23297  *
23298  * Every node in the ast has a type defined in ast::AstNodeType.
23299  * This type name can be returned as a std::string for printing
23300  * node to text/json form.
23301  *
23302  * \return name of the node type as a string i.e. "ElseStatement"
23303  *
23304  * \sa Ast::get_node_name
23305  */
23306  std::string get_node_type_name() const noexcept override {
23307  return "ElseStatement";
23308  }
23309 
23310  /**
23311  * \brief Return NMODL statement of ast node as std::string
23312  *
23313  * Every node is related to a special statement in the NMODL. This
23314  * statement can be returned as a std::string for printing to
23315  * text/json form.
23316  *
23317  * \return name of the statement as a string i.e. " ELSE "
23318  *
23319  * \sa Ast::get_nmodl_name
23320  */
23321  std::string get_nmodl_name() const noexcept override { return " ELSE "; }
23322 
23323  /**
23324  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23325  */
23326  std::shared_ptr<Ast> get_shared_ptr() override {
23327  return std::static_pointer_cast<ElseStatement>(shared_from_this());
23328  }
23329 
23330  /**
23331  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23332  */
23333  std::shared_ptr<const Ast> get_shared_ptr() const override {
23334  return std::static_pointer_cast<const ElseStatement>(shared_from_this());
23335  }
23336 
23337  /**
23338  * \brief Return associated token for the current ast node
23339  *
23340  * Not all ast nodes have token information. For example,
23341  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
23342  * solution of ODEs. In this case, we return nullptr to store in the
23343  * nmodl::symtab::SymbolTable.
23344  *
23345  * \return pointer to token if exist otherwise nullptr
23346  */
23347  const ModToken *get_token() const noexcept override { return token.get(); }
23348 
23349  /**
23350  * \brief Getter for member variable \ref ElseStatement.statement_block
23351  */
23352  const std::shared_ptr<StatementBlock> &get_statement_block() const
23353  noexcept override {
23354  return statement_block;
23355  }
23356 
23357  /// \}
23358 
23359  /// \name Setters
23360  /// \{
23361 
23362  /**
23363  * \brief Set token for the current ast node
23364  */
23365  void set_token(const ModToken &tok) {
23366  token = std::make_shared<ModToken>(tok);
23367  }
23368 
23369  /**
23370  * \brief Setter for member variable \ref ElseStatement.statement_block
23371  * (rvalue reference)
23372  */
23373  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
23374 
23375  /**
23376  * \brief Setter for member variable \ref ElseStatement.statement_block
23377  */
23378  void
23379  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
23380 
23381  /// \}
23382 
23383  /// \name Visitor
23384  /// \{
23385 
23386  /**
23387  * \brief visit children i.e. member variables of current node using provided
23388  * visitor
23389  *
23390  * Different nodes in the AST have different members (i.e. children). This
23391  * method recursively visits children using provided visitor.
23392  *
23393  * \param v Concrete visitor that will be used to recursively visit children
23394  *
23395  * \sa Ast::visit_children for example.
23396  */
23397  void visit_children(visitor::Visitor &v) override;
23398 
23399  /**
23400  * \brief accept (or visit) the current AST node using provided visitor
23401  *
23402  * Instead of visiting children of AST node, like Ast::visit_children,
23403  * accept allows to visit the current node itself using provided concrete
23404  * visitor.
23405  *
23406  * \param v Concrete visitor that will be used to recursively visit node
23407  *
23408  * \sa Ast::accept for example.
23409  */
23410  void accept(visitor::Visitor &v) override;
23411 
23412  /// \}
23413 
23414 private:
23415  /**
23416  * \brief Set this object as parent for all the children
23417  *
23418  * This should be called in every object (with children) constructor
23419  * to set parents. Since it is called only in the constructors it
23420  * should not be virtual to avoid ambiguities (issue #295).
23421  */
23422  void set_parent_in_children();
23423 };
23424 
23425 /** @} */ // end of ast_class
23426 
23427 } // namespace ast
23428 } // namespace nmodl
23429 #endif // !NMODL_AST_ELSE_STATEMENT_HPP
23430 #ifndef NMODL_AST_PARTIAL_EQUATION_HPP
23431 #define NMODL_AST_PARTIAL_EQUATION_HPP
23432 
23433 namespace nmodl {
23434 namespace ast {
23435 
23436 /**
23437  * @addtogroup ast_class
23438  * @ingroup ast
23439  * @{
23440  */
23441 
23442 /**
23443  * \brief TODO
23444  *
23445  *
23446  */
23447 class PartialEquation : public Statement {
23448 private:
23449  /// TODO
23450  std::shared_ptr<PrimeName> prime;
23451  /// TODO
23452  std::shared_ptr<Name> name1;
23453  /// TODO
23454  std::shared_ptr<Name> name2;
23455  /// TODO
23456  std::shared_ptr<Name> name3;
23457  /// token with location information
23458  std::shared_ptr<ModToken> token;
23459 
23460 public:
23461  /// \name Ctor & dtor
23462  /// \{
23463 
23464  explicit PartialEquation(PrimeName *prime, Name *name1, Name *name2,
23465  Name *name3);
23466  explicit PartialEquation(const std::shared_ptr<PrimeName> &prime,
23467  const std::shared_ptr<Name> &name1,
23468  const std::shared_ptr<Name> &name2,
23469  const std::shared_ptr<Name> &name3);
23470  PartialEquation(const PartialEquation &obj);
23471 
23472  virtual ~PartialEquation() = default;
23473 
23474  /// \}
23475 
23476  /**
23477  * \brief Check if the ast node is an instance of ast::PartialEquation
23478  * \return true as object is of type ast::PartialEquation
23479  */
23480  bool is_partial_equation() const noexcept override { return true; }
23481 
23482  /**
23483  * \brief Return a copy of the current node
23484  *
23485  * Recursively make a new copy/clone of the current node including
23486  * all members and return a pointer to the node. This is used for
23487  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23488  * ast.
23489  *
23490  * @return pointer to the clone/copy of the current node
23491  */
23492  PartialEquation *clone() const override { return new PartialEquation(*this); }
23493 
23494  /// \name Getters
23495  /// \{
23496 
23497  /**
23498  * \brief Return type (ast::AstNodeType) of ast node
23499  *
23500  * Every node in the ast has a type defined in ast::AstNodeType and this
23501  * function is used to retrieve the same.
23502  *
23503  * \return ast node type i.e. ast::AstNodeType::PARTIAL_EQUATION
23504  *
23505  * \sa Ast::get_node_type_name
23506  */
23507  AstNodeType get_node_type() const noexcept override {
23509  }
23510 
23511  /**
23512  * \brief Return type (ast::AstNodeType) of ast node as std::string
23513  *
23514  * Every node in the ast has a type defined in ast::AstNodeType.
23515  * This type name can be returned as a std::string for printing
23516  * node to text/json form.
23517  *
23518  * \return name of the node type as a string i.e. "PartialEquation"
23519  *
23520  * \sa Ast::get_node_name
23521  */
23522  std::string get_node_type_name() const noexcept override {
23523  return "PartialEquation";
23524  }
23525 
23526  /**
23527  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23528  */
23529  std::shared_ptr<Ast> get_shared_ptr() override {
23530  return std::static_pointer_cast<PartialEquation>(shared_from_this());
23531  }
23532 
23533  /**
23534  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23535  */
23536  std::shared_ptr<const Ast> get_shared_ptr() const override {
23537  return std::static_pointer_cast<const PartialEquation>(shared_from_this());
23538  }
23539 
23540  /**
23541  * \brief Return associated token for the current ast node
23542  *
23543  * Not all ast nodes have token information. For example,
23544  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
23545  * solution of ODEs. In this case, we return nullptr to store in the
23546  * nmodl::symtab::SymbolTable.
23547  *
23548  * \return pointer to token if exist otherwise nullptr
23549  */
23550  const ModToken *get_token() const noexcept override { return token.get(); }
23551 
23552  /**
23553  * \brief Getter for member variable \ref PartialEquation.prime
23554  */
23555  const std::shared_ptr<PrimeName> &get_prime() const noexcept { return prime; }
23556 
23557  /**
23558  * \brief Getter for member variable \ref PartialEquation.name1
23559  */
23560  const std::shared_ptr<Name> &get_name1() const noexcept { return name1; }
23561 
23562  /**
23563  * \brief Getter for member variable \ref PartialEquation.name2
23564  */
23565  const std::shared_ptr<Name> &get_name2() const noexcept { return name2; }
23566 
23567  /**
23568  * \brief Getter for member variable \ref PartialEquation.name3
23569  */
23570  const std::shared_ptr<Name> &get_name3() const noexcept { return name3; }
23571 
23572  /// \}
23573 
23574  /// \name Setters
23575  /// \{
23576 
23577  /**
23578  * \brief Set token for the current ast node
23579  */
23580  void set_token(const ModToken &tok) {
23581  token = std::make_shared<ModToken>(tok);
23582  }
23583 
23584  /**
23585  * \brief Setter for member variable \ref PartialEquation.prime (rvalue
23586  * reference)
23587  */
23588  void set_prime(std::shared_ptr<PrimeName> &&prime);
23589 
23590  /**
23591  * \brief Setter for member variable \ref PartialEquation.prime
23592  */
23593  void set_prime(const std::shared_ptr<PrimeName> &prime);
23594 
23595  /**
23596  * \brief Setter for member variable \ref PartialEquation.name1 (rvalue
23597  * reference)
23598  */
23599  void set_name1(std::shared_ptr<Name> &&name1);
23600 
23601  /**
23602  * \brief Setter for member variable \ref PartialEquation.name1
23603  */
23604  void set_name1(const std::shared_ptr<Name> &name1);
23605 
23606  /**
23607  * \brief Setter for member variable \ref PartialEquation.name2 (rvalue
23608  * reference)
23609  */
23610  void set_name2(std::shared_ptr<Name> &&name2);
23611 
23612  /**
23613  * \brief Setter for member variable \ref PartialEquation.name2
23614  */
23615  void set_name2(const std::shared_ptr<Name> &name2);
23616 
23617  /**
23618  * \brief Setter for member variable \ref PartialEquation.name3 (rvalue
23619  * reference)
23620  */
23621  void set_name3(std::shared_ptr<Name> &&name3);
23622 
23623  /**
23624  * \brief Setter for member variable \ref PartialEquation.name3
23625  */
23626  void set_name3(const std::shared_ptr<Name> &name3);
23627 
23628  /// \}
23629 
23630  /// \name Visitor
23631  /// \{
23632 
23633  /**
23634  * \brief visit children i.e. member variables of current node using provided
23635  * visitor
23636  *
23637  * Different nodes in the AST have different members (i.e. children). This
23638  * method recursively visits children using provided visitor.
23639  *
23640  * \param v Concrete visitor that will be used to recursively visit children
23641  *
23642  * \sa Ast::visit_children for example.
23643  */
23644  void visit_children(visitor::Visitor &v) override;
23645 
23646  /**
23647  * \brief accept (or visit) the current AST node using provided visitor
23648  *
23649  * Instead of visiting children of AST node, like Ast::visit_children,
23650  * accept allows to visit the current node itself using provided concrete
23651  * visitor.
23652  *
23653  * \param v Concrete visitor that will be used to recursively visit node
23654  *
23655  * \sa Ast::accept for example.
23656  */
23657  void accept(visitor::Visitor &v) override;
23658 
23659  /// \}
23660 
23661 private:
23662  /**
23663  * \brief Set this object as parent for all the children
23664  *
23665  * This should be called in every object (with children) constructor
23666  * to set parents. Since it is called only in the constructors it
23667  * should not be virtual to avoid ambiguities (issue #295).
23668  */
23669  void set_parent_in_children();
23670 };
23671 
23672 /** @} */ // end of ast_class
23673 
23674 } // namespace ast
23675 } // namespace nmodl
23676 #endif // !NMODL_AST_PARTIAL_EQUATION_HPP
23677 #ifndef NMODL_AST_PARTIAL_BOUNDARY_HPP
23678 #define NMODL_AST_PARTIAL_BOUNDARY_HPP
23679 
23680 namespace nmodl {
23681 namespace ast {
23682 
23683 /**
23684  * @addtogroup ast_class
23685  * @ingroup ast
23686  * @{
23687  */
23688 
23689 /**
23690  * \brief TODO
23691  *
23692  *
23693  */
23694 class PartialBoundary : public Statement {
23695 private:
23696  /// TODO
23697  std::shared_ptr<Name> del;
23698  /// TODO
23699  std::shared_ptr<Identifier> name;
23700  /// TODO
23701  std::shared_ptr<FirstLastTypeIndex> index;
23702  /// TODO
23703  std::shared_ptr<Expression> expression;
23704  /// TODO
23705  std::shared_ptr<Name> name1;
23706  /// TODO
23707  std::shared_ptr<Name> del2;
23708  /// TODO
23709  std::shared_ptr<Name> name2;
23710  /// TODO
23711  std::shared_ptr<Name> name3;
23712  /// token with location information
23713  std::shared_ptr<ModToken> token;
23714 
23715 public:
23716  /// \name Ctor & dtor
23717  /// \{
23718 
23719  explicit PartialBoundary(Name *del, Identifier *name,
23720  FirstLastTypeIndex *index, Expression *expression,
23721  Name *name1, Name *del2, Name *name2, Name *name3);
23722  explicit PartialBoundary(const std::shared_ptr<Name> &del,
23723  const std::shared_ptr<Identifier> &name,
23724  const std::shared_ptr<FirstLastTypeIndex> &index,
23725  const std::shared_ptr<Expression> &expression,
23726  const std::shared_ptr<Name> &name1,
23727  const std::shared_ptr<Name> &del2,
23728  const std::shared_ptr<Name> &name2,
23729  const std::shared_ptr<Name> &name3);
23730  PartialBoundary(const PartialBoundary &obj);
23731 
23732  virtual ~PartialBoundary() = default;
23733 
23734  /// \}
23735 
23736  /**
23737  * \brief Check if the ast node is an instance of ast::PartialBoundary
23738  * \return true as object is of type ast::PartialBoundary
23739  */
23740  bool is_partial_boundary() const noexcept override { return true; }
23741 
23742  /**
23743  * \brief Return a copy of the current node
23744  *
23745  * Recursively make a new copy/clone of the current node including
23746  * all members and return a pointer to the node. This is used for
23747  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23748  * ast.
23749  *
23750  * @return pointer to the clone/copy of the current node
23751  */
23752  PartialBoundary *clone() const override { return new PartialBoundary(*this); }
23753 
23754  /// \name Getters
23755  /// \{
23756 
23757  /**
23758  * \brief Return type (ast::AstNodeType) of ast node
23759  *
23760  * Every node in the ast has a type defined in ast::AstNodeType and this
23761  * function is used to retrieve the same.
23762  *
23763  * \return ast node type i.e. ast::AstNodeType::PARTIAL_BOUNDARY
23764  *
23765  * \sa Ast::get_node_type_name
23766  */
23767  AstNodeType get_node_type() const noexcept override {
23769  }
23770 
23771  /**
23772  * \brief Return type (ast::AstNodeType) of ast node as std::string
23773  *
23774  * Every node in the ast has a type defined in ast::AstNodeType.
23775  * This type name can be returned as a std::string for printing
23776  * node to text/json form.
23777  *
23778  * \return name of the node type as a string i.e. "PartialBoundary"
23779  *
23780  * \sa Ast::get_node_name
23781  */
23782  std::string get_node_type_name() const noexcept override {
23783  return "PartialBoundary";
23784  }
23785 
23786  /**
23787  * \brief Return NMODL statement of ast node as std::string
23788  *
23789  * Every node is related to a special statement in the NMODL. This
23790  * statement can be returned as a std::string for printing to
23791  * text/json form.
23792  *
23793  * \return name of the statement as a string i.e. "~ "
23794  *
23795  * \sa Ast::get_nmodl_name
23796  */
23797  std::string get_nmodl_name() const noexcept override { return "~ "; }
23798 
23799  /**
23800  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23801  */
23802  std::shared_ptr<Ast> get_shared_ptr() override {
23803  return std::static_pointer_cast<PartialBoundary>(shared_from_this());
23804  }
23805 
23806  /**
23807  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23808  */
23809  std::shared_ptr<const Ast> get_shared_ptr() const override {
23810  return std::static_pointer_cast<const PartialBoundary>(shared_from_this());
23811  }
23812 
23813  /**
23814  * \brief Return associated token for the current ast node
23815  *
23816  * Not all ast nodes have token information. For example,
23817  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
23818  * solution of ODEs. In this case, we return nullptr to store in the
23819  * nmodl::symtab::SymbolTable.
23820  *
23821  * \return pointer to token if exist otherwise nullptr
23822  */
23823  const ModToken *get_token() const noexcept override { return token.get(); }
23824 
23825  /**
23826  * \brief Getter for member variable \ref PartialBoundary.del
23827  */
23828  const std::shared_ptr<Name> &get_del() const noexcept { return del; }
23829 
23830  /**
23831  * \brief Getter for member variable \ref PartialBoundary.name
23832  */
23833  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
23834 
23835  /**
23836  * \brief Getter for member variable \ref PartialBoundary.index
23837  */
23838  const std::shared_ptr<FirstLastTypeIndex> &get_index() const noexcept {
23839  return index;
23840  }
23841 
23842  /**
23843  * \brief Getter for member variable \ref PartialBoundary.expression
23844  */
23845  const std::shared_ptr<Expression> &get_expression() const noexcept {
23846  return expression;
23847  }
23848 
23849  /**
23850  * \brief Getter for member variable \ref PartialBoundary.name1
23851  */
23852  const std::shared_ptr<Name> &get_name1() const noexcept { return name1; }
23853 
23854  /**
23855  * \brief Getter for member variable \ref PartialBoundary.del2
23856  */
23857  const std::shared_ptr<Name> &get_del2() const noexcept { return del2; }
23858 
23859  /**
23860  * \brief Getter for member variable \ref PartialBoundary.name2
23861  */
23862  const std::shared_ptr<Name> &get_name2() const noexcept { return name2; }
23863 
23864  /**
23865  * \brief Getter for member variable \ref PartialBoundary.name3
23866  */
23867  const std::shared_ptr<Name> &get_name3() const noexcept { return name3; }
23868 
23869  /// \}
23870 
23871  /// \name Setters
23872  /// \{
23873 
23874  /**
23875  * \brief Set token for the current ast node
23876  */
23877  void set_token(const ModToken &tok) {
23878  token = std::make_shared<ModToken>(tok);
23879  }
23880 
23881  /**
23882  * \brief Setter for member variable \ref PartialBoundary.del (rvalue
23883  * reference)
23884  */
23885  void set_del(std::shared_ptr<Name> &&del);
23886 
23887  /**
23888  * \brief Setter for member variable \ref PartialBoundary.del
23889  */
23890  void set_del(const std::shared_ptr<Name> &del);
23891 
23892  /**
23893  * \brief Setter for member variable \ref PartialBoundary.name (rvalue
23894  * reference)
23895  */
23896  void set_name(std::shared_ptr<Identifier> &&name);
23897 
23898  /**
23899  * \brief Setter for member variable \ref PartialBoundary.name
23900  */
23901  void set_name(const std::shared_ptr<Identifier> &name);
23902 
23903  /**
23904  * \brief Setter for member variable \ref PartialBoundary.index (rvalue
23905  * reference)
23906  */
23907  void set_index(std::shared_ptr<FirstLastTypeIndex> &&index);
23908 
23909  /**
23910  * \brief Setter for member variable \ref PartialBoundary.index
23911  */
23912  void set_index(const std::shared_ptr<FirstLastTypeIndex> &index);
23913 
23914  /**
23915  * \brief Setter for member variable \ref PartialBoundary.expression (rvalue
23916  * reference)
23917  */
23918  void set_expression(std::shared_ptr<Expression> &&expression);
23919 
23920  /**
23921  * \brief Setter for member variable \ref PartialBoundary.expression
23922  */
23923  void set_expression(const std::shared_ptr<Expression> &expression);
23924 
23925  /**
23926  * \brief Setter for member variable \ref PartialBoundary.name1 (rvalue
23927  * reference)
23928  */
23929  void set_name1(std::shared_ptr<Name> &&name1);
23930 
23931  /**
23932  * \brief Setter for member variable \ref PartialBoundary.name1
23933  */
23934  void set_name1(const std::shared_ptr<Name> &name1);
23935 
23936  /**
23937  * \brief Setter for member variable \ref PartialBoundary.del2 (rvalue
23938  * reference)
23939  */
23940  void set_del2(std::shared_ptr<Name> &&del2);
23941 
23942  /**
23943  * \brief Setter for member variable \ref PartialBoundary.del2
23944  */
23945  void set_del2(const std::shared_ptr<Name> &del2);
23946 
23947  /**
23948  * \brief Setter for member variable \ref PartialBoundary.name2 (rvalue
23949  * reference)
23950  */
23951  void set_name2(std::shared_ptr<Name> &&name2);
23952 
23953  /**
23954  * \brief Setter for member variable \ref PartialBoundary.name2
23955  */
23956  void set_name2(const std::shared_ptr<Name> &name2);
23957 
23958  /**
23959  * \brief Setter for member variable \ref PartialBoundary.name3 (rvalue
23960  * reference)
23961  */
23962  void set_name3(std::shared_ptr<Name> &&name3);
23963 
23964  /**
23965  * \brief Setter for member variable \ref PartialBoundary.name3
23966  */
23967  void set_name3(const std::shared_ptr<Name> &name3);
23968 
23969  /// \}
23970 
23971  /// \name Visitor
23972  /// \{
23973 
23974  /**
23975  * \brief visit children i.e. member variables of current node using provided
23976  * visitor
23977  *
23978  * Different nodes in the AST have different members (i.e. children). This
23979  * method recursively visits children using provided visitor.
23980  *
23981  * \param v Concrete visitor that will be used to recursively visit children
23982  *
23983  * \sa Ast::visit_children for example.
23984  */
23985  void visit_children(visitor::Visitor &v) override;
23986 
23987  /**
23988  * \brief accept (or visit) the current AST node using provided visitor
23989  *
23990  * Instead of visiting children of AST node, like Ast::visit_children,
23991  * accept allows to visit the current node itself using provided concrete
23992  * visitor.
23993  *
23994  * \param v Concrete visitor that will be used to recursively visit node
23995  *
23996  * \sa Ast::accept for example.
23997  */
23998  void accept(visitor::Visitor &v) override;
23999 
24000  /// \}
24001 
24002 private:
24003  /**
24004  * \brief Set this object as parent for all the children
24005  *
24006  * This should be called in every object (with children) constructor
24007  * to set parents. Since it is called only in the constructors it
24008  * should not be virtual to avoid ambiguities (issue #295).
24009  */
24010  void set_parent_in_children();
24011 };
24012 
24013 /** @} */ // end of ast_class
24014 
24015 } // namespace ast
24016 } // namespace nmodl
24017 #endif // !NMODL_AST_PARTIAL_BOUNDARY_HPP
24018 #ifndef NMODL_AST_WATCH_STATEMENT_HPP
24019 #define NMODL_AST_WATCH_STATEMENT_HPP
24020 
24021 namespace nmodl {
24022 namespace ast {
24023 
24024 /**
24025  * @addtogroup ast_class
24026  * @ingroup ast
24027  * @{
24028  */
24029 
24030 /**
24031  * \brief Represent WATCH statement in NMODL
24032  *
24033  *
24034  */
24035 class WatchStatement : public Statement {
24036 private:
24037  /// Vector of watch statements
24039  /// token with location information
24040  std::shared_ptr<ModToken> token;
24041 
24042 public:
24043  /// \name Ctor & dtor
24044  /// \{
24045 
24046  explicit WatchStatement(WatchVector statements);
24047  WatchStatement(const WatchStatement &obj);
24048 
24049  virtual ~WatchStatement() = default;
24050 
24051  /// \}
24052 
24053  /**
24054  * \brief Check if the ast node is an instance of ast::WatchStatement
24055  * \return true as object is of type ast::WatchStatement
24056  */
24057  bool is_watch_statement() const noexcept override { return true; }
24058 
24059  /**
24060  * \brief Return a copy of the current node
24061  *
24062  * Recursively make a new copy/clone of the current node including
24063  * all members and return a pointer to the node. This is used for
24064  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24065  * ast.
24066  *
24067  * @return pointer to the clone/copy of the current node
24068  */
24069  WatchStatement *clone() const override { return new WatchStatement(*this); }
24070 
24071  /// \name Getters
24072  /// \{
24073 
24074  /**
24075  * \brief Return type (ast::AstNodeType) of ast node
24076  *
24077  * Every node in the ast has a type defined in ast::AstNodeType and this
24078  * function is used to retrieve the same.
24079  *
24080  * \return ast node type i.e. ast::AstNodeType::WATCH_STATEMENT
24081  *
24082  * \sa Ast::get_node_type_name
24083  */
24084  AstNodeType get_node_type() const noexcept override {
24086  }
24087 
24088  /**
24089  * \brief Return type (ast::AstNodeType) of ast node as std::string
24090  *
24091  * Every node in the ast has a type defined in ast::AstNodeType.
24092  * This type name can be returned as a std::string for printing
24093  * node to text/json form.
24094  *
24095  * \return name of the node type as a string i.e. "WatchStatement"
24096  *
24097  * \sa Ast::get_node_name
24098  */
24099  std::string get_node_type_name() const noexcept override {
24100  return "WatchStatement";
24101  }
24102 
24103  /**
24104  * \brief Return NMODL statement of ast node as std::string
24105  *
24106  * Every node is related to a special statement in the NMODL. This
24107  * statement can be returned as a std::string for printing to
24108  * text/json form.
24109  *
24110  * \return name of the statement as a string i.e. "WATCH "
24111  *
24112  * \sa Ast::get_nmodl_name
24113  */
24114  std::string get_nmodl_name() const noexcept override { return "WATCH "; }
24115 
24116  /**
24117  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24118  */
24119  std::shared_ptr<Ast> get_shared_ptr() override {
24120  return std::static_pointer_cast<WatchStatement>(shared_from_this());
24121  }
24122 
24123  /**
24124  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24125  */
24126  std::shared_ptr<const Ast> get_shared_ptr() const override {
24127  return std::static_pointer_cast<const WatchStatement>(shared_from_this());
24128  }
24129 
24130  /**
24131  * \brief Return associated token for the current ast node
24132  *
24133  * Not all ast nodes have token information. For example,
24134  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
24135  * solution of ODEs. In this case, we return nullptr to store in the
24136  * nmodl::symtab::SymbolTable.
24137  *
24138  * \return pointer to token if exist otherwise nullptr
24139  */
24140  const ModToken *get_token() const noexcept override { return token.get(); }
24141 
24142  /**
24143  * \brief Add member to statements by raw pointer
24144  */
24146  statements.emplace_back(n);
24147 
24148  // set parents
24149  n->set_parent(this);
24150  }
24151 
24152  /**
24153  * \brief Add member to statements by shared_ptr
24154  */
24155  void emplace_back_watch(std::shared_ptr<Watch> n) {
24156  statements.emplace_back(n);
24157  // set parents
24158  n->set_parent(this);
24159  }
24160 
24161  /**
24162  * \brief Erase member to statements
24163  */
24164  WatchVector::const_iterator erase_watch(WatchVector::const_iterator first) {
24165  auto first_it = const_iter_cast(statements, first);
24166  return statements.erase(first_it);
24167  }
24168  /**
24169  * \brief Erase members to statements
24170  */
24171  WatchVector::const_iterator erase_watch(WatchVector::const_iterator first,
24172  WatchVector::const_iterator last) {
24173  auto first_it = const_iter_cast(statements, first);
24174  auto last_it = const_iter_cast(statements, last);
24175  return statements.erase(first_it, last_it);
24176  }
24177  /**
24178  * \brief Erase non-consecutive members to statements
24179  *
24180  * loosely following the cpp reference of remove_if
24181  */
24182  size_t erase_watch(std::unordered_set<Watch *> &to_be_erased) {
24183  auto first = statements.begin();
24184  auto last = statements.end();
24185  auto result = first;
24186 
24187  while (first != last) {
24188  // automatically erase dangling pointers from the uset while
24189  // looking for them to erase them in the vector
24190  if (to_be_erased.erase(first->get()) == 0) {
24191  reset_watch(result, *first);
24192  ++result;
24193  }
24194  ++first;
24195  }
24196 
24197  size_t out = last - result;
24198  erase_watch(result, last);
24199 
24200  return out;
24201  }
24202 
24203  /**
24204  * \brief Insert member to statements
24205  */
24206  WatchVector::const_iterator insert_watch(WatchVector::const_iterator position,
24207  const std::shared_ptr<Watch> &n) {
24208  n->set_parent(this);
24209  auto pos_it = const_iter_cast(statements, position);
24210  return statements.insert(pos_it, n);
24211  }
24212  /**
24213  * \brief Insert members to statements
24214  */
24215  template <class NodeType, class InputIterator>
24216  void insert_watch(WatchVector::const_iterator position, NodeType &to,
24217  InputIterator first, InputIterator last) {
24218 
24219  for (auto it = first; it != last; ++it) {
24220  auto &n = *it;
24221  // set parents
24222  n->set_parent(this);
24223  }
24224  auto pos_it = const_iter_cast(statements, position);
24225  auto first_it = const_iter_cast(to, first);
24226  auto last_it = const_iter_cast(to, last);
24227  statements.insert(pos_it, first_it, last_it);
24228  }
24229 
24230  /**
24231  * \brief Reset member to statements
24232  */
24233  void reset_watch(WatchVector::const_iterator position, Watch *n) {
24234  // set parents
24235  n->set_parent(this);
24236 
24237  statements[position - statements.begin()].reset(n);
24238  }
24239 
24240  /**
24241  * \brief Reset member to statements
24242  */
24243  void reset_watch(WatchVector::const_iterator position,
24244  std::shared_ptr<Watch> n) {
24245  // set parents
24246  n->set_parent(this);
24247 
24248  statements[position - statements.begin()] = n;
24249  }
24250 
24251  /**
24252  * \brief Getter for member variable \ref WatchStatement.statements
24253  */
24254  const WatchVector &get_statements() const noexcept { return statements; }
24255 
24256  /// \}
24257 
24258  /// \name Setters
24259  /// \{
24260 
24261  /**
24262  * \brief Set token for the current ast node
24263  */
24264  void set_token(const ModToken &tok) {
24265  token = std::make_shared<ModToken>(tok);
24266  }
24267 
24268  /**
24269  * \brief Setter for member variable \ref WatchStatement.statements (rvalue
24270  * reference)
24271  */
24272  void set_statements(WatchVector &&statements);
24273 
24274  /**
24275  * \brief Setter for member variable \ref WatchStatement.statements
24276  */
24277  void set_statements(const WatchVector &statements);
24278 
24279  /// \}
24280 
24281  /// \name Visitor
24282  /// \{
24283 
24284  /**
24285  * \brief visit children i.e. member variables of current node using provided
24286  * visitor
24287  *
24288  * Different nodes in the AST have different members (i.e. children). This
24289  * method recursively visits children using provided visitor.
24290  *
24291  * \param v Concrete visitor that will be used to recursively visit children
24292  *
24293  * \sa Ast::visit_children for example.
24294  */
24295  void visit_children(visitor::Visitor &v) override;
24296 
24297  /**
24298  * \brief accept (or visit) the current AST node using provided visitor
24299  *
24300  * Instead of visiting children of AST node, like Ast::visit_children,
24301  * accept allows to visit the current node itself using provided concrete
24302  * visitor.
24303  *
24304  * \param v Concrete visitor that will be used to recursively visit node
24305  *
24306  * \sa Ast::accept for example.
24307  */
24308  void accept(visitor::Visitor &v) override;
24309 
24310  /// \}
24311 
24312 private:
24313  /**
24314  * \brief Set this object as parent for all the children
24315  *
24316  * This should be called in every object (with children) constructor
24317  * to set parents. Since it is called only in the constructors it
24318  * should not be virtual to avoid ambiguities (issue #295).
24319  */
24320  void set_parent_in_children();
24321 };
24322 
24323 /** @} */ // end of ast_class
24324 
24325 } // namespace ast
24326 } // namespace nmodl
24327 #endif // !NMODL_AST_WATCH_STATEMENT_HPP
24328 #ifndef NMODL_AST_MUTEX_LOCK_HPP
24329 #define NMODL_AST_MUTEX_LOCK_HPP
24330 
24331 namespace nmodl {
24332 namespace ast {
24333 
24334 /**
24335  * @addtogroup ast_class
24336  * @ingroup ast
24337  * @{
24338  */
24339 
24340 /**
24341  * \brief Represent MUTEXLOCK statement in NMODL
24342  *
24343  *
24344  */
24345 class MutexLock : public Statement {
24346 private:
24347  /// token with location information
24348  std::shared_ptr<ModToken> token;
24349 
24350 public:
24351  /// \name Ctor & dtor
24352  /// \{
24353 
24354  virtual ~MutexLock() = default;
24355 
24356  /// \}
24357 
24358  /**
24359  * \brief Check if the ast node is an instance of ast::MutexLock
24360  * \return true as object is of type ast::MutexLock
24361  */
24362  bool is_mutex_lock() const noexcept override { return true; }
24363 
24364  /**
24365  * \brief Return a copy of the current node
24366  *
24367  * Recursively make a new copy/clone of the current node including
24368  * all members and return a pointer to the node. This is used for
24369  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24370  * ast.
24371  *
24372  * @return pointer to the clone/copy of the current node
24373  */
24374  MutexLock *clone() const override { return new MutexLock(*this); }
24375 
24376  /// \name Getters
24377  /// \{
24378 
24379  /**
24380  * \brief Return type (ast::AstNodeType) of ast node
24381  *
24382  * Every node in the ast has a type defined in ast::AstNodeType and this
24383  * function is used to retrieve the same.
24384  *
24385  * \return ast node type i.e. ast::AstNodeType::MUTEX_LOCK
24386  *
24387  * \sa Ast::get_node_type_name
24388  */
24389  AstNodeType get_node_type() const noexcept override {
24390  return AstNodeType::MUTEX_LOCK;
24391  }
24392 
24393  /**
24394  * \brief Return type (ast::AstNodeType) of ast node as std::string
24395  *
24396  * Every node in the ast has a type defined in ast::AstNodeType.
24397  * This type name can be returned as a std::string for printing
24398  * node to text/json form.
24399  *
24400  * \return name of the node type as a string i.e. "MutexLock"
24401  *
24402  * \sa Ast::get_node_name
24403  */
24404  std::string get_node_type_name() const noexcept override {
24405  return "MutexLock";
24406  }
24407 
24408  /**
24409  * \brief Return NMODL statement of ast node as std::string
24410  *
24411  * Every node is related to a special statement in the NMODL. This
24412  * statement can be returned as a std::string for printing to
24413  * text/json form.
24414  *
24415  * \return name of the statement as a string i.e. "MUTEXLOCK"
24416  *
24417  * \sa Ast::get_nmodl_name
24418  */
24419  std::string get_nmodl_name() const noexcept override { return "MUTEXLOCK"; }
24420 
24421  /**
24422  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24423  */
24424  std::shared_ptr<Ast> get_shared_ptr() override {
24425  return std::static_pointer_cast<MutexLock>(shared_from_this());
24426  }
24427 
24428  /**
24429  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24430  */
24431  std::shared_ptr<const Ast> get_shared_ptr() const override {
24432  return std::static_pointer_cast<const MutexLock>(shared_from_this());
24433  }
24434 
24435  /**
24436  * \brief Return associated token for the current ast node
24437  *
24438  * Not all ast nodes have token information. For example,
24439  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
24440  * solution of ODEs. In this case, we return nullptr to store in the
24441  * nmodl::symtab::SymbolTable.
24442  *
24443  * \return pointer to token if exist otherwise nullptr
24444  */
24445  const ModToken *get_token() const noexcept override { return token.get(); }
24446 
24447  /// \}
24448 
24449  /// \name Setters
24450  /// \{
24451 
24452  /**
24453  * \brief Set token for the current ast node
24454  */
24455  void set_token(const ModToken &tok) {
24456  token = std::make_shared<ModToken>(tok);
24457  }
24458 
24459  /// \}
24460 
24461  /// \name Visitor
24462  /// \{
24463 
24464  /**
24465  * \brief visit children i.e. member variables of current node using provided
24466  * visitor
24467  *
24468  * Different nodes in the AST have different members (i.e. children). This
24469  * method recursively visits children using provided visitor.
24470  *
24471  * \param v Concrete visitor that will be used to recursively visit children
24472  *
24473  * \sa Ast::visit_children for example.
24474  */
24475  void visit_children(visitor::Visitor &v) override;
24476 
24477  /**
24478  * \brief accept (or visit) the current AST node using provided visitor
24479  *
24480  * Instead of visiting children of AST node, like Ast::visit_children,
24481  * accept allows to visit the current node itself using provided concrete
24482  * visitor.
24483  *
24484  * \param v Concrete visitor that will be used to recursively visit node
24485  *
24486  * \sa Ast::accept for example.
24487  */
24488  void accept(visitor::Visitor &v) override;
24489 
24490  /// \}
24491 };
24492 
24493 /** @} */ // end of ast_class
24494 
24495 } // namespace ast
24496 } // namespace nmodl
24497 #endif // !NMODL_AST_MUTEX_LOCK_HPP
24498 #ifndef NMODL_AST_MUTEX_UNLOCK_HPP
24499 #define NMODL_AST_MUTEX_UNLOCK_HPP
24500 
24501 namespace nmodl {
24502 namespace ast {
24503 
24504 /**
24505  * @addtogroup ast_class
24506  * @ingroup ast
24507  * @{
24508  */
24509 
24510 /**
24511  * \brief Represent MUTEXUNLOCK statement in NMODL
24512  *
24513  *
24514  */
24515 class MutexUnlock : public Statement {
24516 private:
24517  /// token with location information
24518  std::shared_ptr<ModToken> token;
24519 
24520 public:
24521  /// \name Ctor & dtor
24522  /// \{
24523 
24524  virtual ~MutexUnlock() = default;
24525 
24526  /// \}
24527 
24528  /**
24529  * \brief Check if the ast node is an instance of ast::MutexUnlock
24530  * \return true as object is of type ast::MutexUnlock
24531  */
24532  bool is_mutex_unlock() const noexcept override { return true; }
24533 
24534  /**
24535  * \brief Return a copy of the current node
24536  *
24537  * Recursively make a new copy/clone of the current node including
24538  * all members and return a pointer to the node. This is used for
24539  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24540  * ast.
24541  *
24542  * @return pointer to the clone/copy of the current node
24543  */
24544  MutexUnlock *clone() const override { return new MutexUnlock(*this); }
24545 
24546  /// \name Getters
24547  /// \{
24548 
24549  /**
24550  * \brief Return type (ast::AstNodeType) of ast node
24551  *
24552  * Every node in the ast has a type defined in ast::AstNodeType and this
24553  * function is used to retrieve the same.
24554  *
24555  * \return ast node type i.e. ast::AstNodeType::MUTEX_UNLOCK
24556  *
24557  * \sa Ast::get_node_type_name
24558  */
24559  AstNodeType get_node_type() const noexcept override {
24561  }
24562 
24563  /**
24564  * \brief Return type (ast::AstNodeType) of ast node as std::string
24565  *
24566  * Every node in the ast has a type defined in ast::AstNodeType.
24567  * This type name can be returned as a std::string for printing
24568  * node to text/json form.
24569  *
24570  * \return name of the node type as a string i.e. "MutexUnlock"
24571  *
24572  * \sa Ast::get_node_name
24573  */
24574  std::string get_node_type_name() const noexcept override {
24575  return "MutexUnlock";
24576  }
24577 
24578  /**
24579  * \brief Return NMODL statement of ast node as std::string
24580  *
24581  * Every node is related to a special statement in the NMODL. This
24582  * statement can be returned as a std::string for printing to
24583  * text/json form.
24584  *
24585  * \return name of the statement as a string i.e. "MUTEXUNLOCK"
24586  *
24587  * \sa Ast::get_nmodl_name
24588  */
24589  std::string get_nmodl_name() const noexcept override { return "MUTEXUNLOCK"; }
24590 
24591  /**
24592  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24593  */
24594  std::shared_ptr<Ast> get_shared_ptr() override {
24595  return std::static_pointer_cast<MutexUnlock>(shared_from_this());
24596  }
24597 
24598  /**
24599  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24600  */
24601  std::shared_ptr<const Ast> get_shared_ptr() const override {
24602  return std::static_pointer_cast<const MutexUnlock>(shared_from_this());
24603  }
24604 
24605  /**
24606  * \brief Return associated token for the current ast node
24607  *
24608  * Not all ast nodes have token information. For example,
24609  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
24610  * solution of ODEs. In this case, we return nullptr to store in the
24611  * nmodl::symtab::SymbolTable.
24612  *
24613  * \return pointer to token if exist otherwise nullptr
24614  */
24615  const ModToken *get_token() const noexcept override { return token.get(); }
24616 
24617  /// \}
24618 
24619  /// \name Setters
24620  /// \{
24621 
24622  /**
24623  * \brief Set token for the current ast node
24624  */
24625  void set_token(const ModToken &tok) {
24626  token = std::make_shared<ModToken>(tok);
24627  }
24628 
24629  /// \}
24630 
24631  /// \name Visitor
24632  /// \{
24633 
24634  /**
24635  * \brief visit children i.e. member variables of current node using provided
24636  * visitor
24637  *
24638  * Different nodes in the AST have different members (i.e. children). This
24639  * method recursively visits children using provided visitor.
24640  *
24641  * \param v Concrete visitor that will be used to recursively visit children
24642  *
24643  * \sa Ast::visit_children for example.
24644  */
24645  void visit_children(visitor::Visitor &v) override;
24646 
24647  /**
24648  * \brief accept (or visit) the current AST node using provided visitor
24649  *
24650  * Instead of visiting children of AST node, like Ast::visit_children,
24651  * accept allows to visit the current node itself using provided concrete
24652  * visitor.
24653  *
24654  * \param v Concrete visitor that will be used to recursively visit node
24655  *
24656  * \sa Ast::accept for example.
24657  */
24658  void accept(visitor::Visitor &v) override;
24659 
24660  /// \}
24661 };
24662 
24663 /** @} */ // end of ast_class
24664 
24665 } // namespace ast
24666 } // namespace nmodl
24667 #endif // !NMODL_AST_MUTEX_UNLOCK_HPP
24668 #ifndef NMODL_AST_RESET_HPP
24669 #define NMODL_AST_RESET_HPP
24670 
24671 namespace nmodl {
24672 namespace ast {
24673 
24674 /**
24675  * @addtogroup ast_class
24676  * @ingroup ast
24677  * @{
24678  */
24679 
24680 /**
24681  * \brief Represent RESET statement in NMODL
24682  *
24683  *
24684  */
24685 class Reset : public Statement {
24686 private:
24687  /// token with location information
24688  std::shared_ptr<ModToken> token;
24689 
24690 public:
24691  /// \name Ctor & dtor
24692  /// \{
24693 
24694  virtual ~Reset() = default;
24695 
24696  /// \}
24697 
24698  /**
24699  * \brief Check if the ast node is an instance of ast::Reset
24700  * \return true as object is of type ast::Reset
24701  */
24702  bool is_reset() const noexcept override { return true; }
24703 
24704  /**
24705  * \brief Return a copy of the current node
24706  *
24707  * Recursively make a new copy/clone of the current node including
24708  * all members and return a pointer to the node. This is used for
24709  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24710  * ast.
24711  *
24712  * @return pointer to the clone/copy of the current node
24713  */
24714  Reset *clone() const override { return new Reset(*this); }
24715 
24716  /// \name Getters
24717  /// \{
24718 
24719  /**
24720  * \brief Return type (ast::AstNodeType) of ast node
24721  *
24722  * Every node in the ast has a type defined in ast::AstNodeType and this
24723  * function is used to retrieve the same.
24724  *
24725  * \return ast node type i.e. ast::AstNodeType::RESET
24726  *
24727  * \sa Ast::get_node_type_name
24728  */
24729  AstNodeType get_node_type() const noexcept override {
24730  return AstNodeType::RESET;
24731  }
24732 
24733  /**
24734  * \brief Return type (ast::AstNodeType) of ast node as std::string
24735  *
24736  * Every node in the ast has a type defined in ast::AstNodeType.
24737  * This type name can be returned as a std::string for printing
24738  * node to text/json form.
24739  *
24740  * \return name of the node type as a string i.e. "Reset"
24741  *
24742  * \sa Ast::get_node_name
24743  */
24744  std::string get_node_type_name() const noexcept override { return "Reset"; }
24745 
24746  /**
24747  * \brief Return NMODL statement of ast node as std::string
24748  *
24749  * Every node is related to a special statement in the NMODL. This
24750  * statement can be returned as a std::string for printing to
24751  * text/json form.
24752  *
24753  * \return name of the statement as a string i.e. "RESET"
24754  *
24755  * \sa Ast::get_nmodl_name
24756  */
24757  std::string get_nmodl_name() const noexcept override { return "RESET"; }
24758 
24759  /**
24760  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24761  */
24762  std::shared_ptr<Ast> get_shared_ptr() override {
24763  return std::static_pointer_cast<Reset>(shared_from_this());
24764  }
24765 
24766  /**
24767  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24768  */
24769  std::shared_ptr<const Ast> get_shared_ptr() const override {
24770  return std::static_pointer_cast<const Reset>(shared_from_this());
24771  }
24772 
24773  /**
24774  * \brief Return associated token for the current ast node
24775  *
24776  * Not all ast nodes have token information. For example,
24777  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
24778  * solution of ODEs. In this case, we return nullptr to store in the
24779  * nmodl::symtab::SymbolTable.
24780  *
24781  * \return pointer to token if exist otherwise nullptr
24782  */
24783  const ModToken *get_token() const noexcept override { return token.get(); }
24784 
24785  /// \}
24786 
24787  /// \name Setters
24788  /// \{
24789 
24790  /**
24791  * \brief Set token for the current ast node
24792  */
24793  void set_token(const ModToken &tok) {
24794  token = std::make_shared<ModToken>(tok);
24795  }
24796 
24797  /// \}
24798 
24799  /// \name Visitor
24800  /// \{
24801 
24802  /**
24803  * \brief visit children i.e. member variables of current node using provided
24804  * visitor
24805  *
24806  * Different nodes in the AST have different members (i.e. children). This
24807  * method recursively visits children using provided visitor.
24808  *
24809  * \param v Concrete visitor that will be used to recursively visit children
24810  *
24811  * \sa Ast::visit_children for example.
24812  */
24813  void visit_children(visitor::Visitor &v) override;
24814 
24815  /**
24816  * \brief accept (or visit) the current AST node using provided visitor
24817  *
24818  * Instead of visiting children of AST node, like Ast::visit_children,
24819  * accept allows to visit the current node itself using provided concrete
24820  * visitor.
24821  *
24822  * \param v Concrete visitor that will be used to recursively visit node
24823  *
24824  * \sa Ast::accept for example.
24825  */
24826  void accept(visitor::Visitor &v) override;
24827 
24828  /// \}
24829 };
24830 
24831 /** @} */ // end of ast_class
24832 
24833 } // namespace ast
24834 } // namespace nmodl
24835 #endif // !NMODL_AST_RESET_HPP
24836 #ifndef NMODL_AST_SENS_HPP
24837 #define NMODL_AST_SENS_HPP
24838 
24839 namespace nmodl {
24840 namespace ast {
24841 
24842 /**
24843  * @addtogroup ast_class
24844  * @ingroup ast
24845  * @{
24846  */
24847 
24848 /**
24849  * \brief Represent SENS statement in NMODL
24850  *
24851  *
24852  */
24853 class Sens : public Statement {
24854 private:
24855  /// TODO
24857  /// token with location information
24858  std::shared_ptr<ModToken> token;
24859 
24860 public:
24861  /// \name Ctor & dtor
24862  /// \{
24863 
24864  explicit Sens(VarNameVector variables);
24865  Sens(const Sens &obj);
24866 
24867  virtual ~Sens() = default;
24868 
24869  /// \}
24870 
24871  /**
24872  * \brief Check if the ast node is an instance of ast::Sens
24873  * \return true as object is of type ast::Sens
24874  */
24875  bool is_sens() const noexcept override { return true; }
24876 
24877  /**
24878  * \brief Return a copy of the current node
24879  *
24880  * Recursively make a new copy/clone of the current node including
24881  * all members and return a pointer to the node. This is used for
24882  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24883  * ast.
24884  *
24885  * @return pointer to the clone/copy of the current node
24886  */
24887  Sens *clone() const override { return new Sens(*this); }
24888 
24889  /// \name Getters
24890  /// \{
24891 
24892  /**
24893  * \brief Return type (ast::AstNodeType) of ast node
24894  *
24895  * Every node in the ast has a type defined in ast::AstNodeType and this
24896  * function is used to retrieve the same.
24897  *
24898  * \return ast node type i.e. ast::AstNodeType::SENS
24899  *
24900  * \sa Ast::get_node_type_name
24901  */
24902  AstNodeType get_node_type() const noexcept override {
24903  return AstNodeType::SENS;
24904  }
24905 
24906  /**
24907  * \brief Return type (ast::AstNodeType) of ast node as std::string
24908  *
24909  * Every node in the ast has a type defined in ast::AstNodeType.
24910  * This type name can be returned as a std::string for printing
24911  * node to text/json form.
24912  *
24913  * \return name of the node type as a string i.e. "Sens"
24914  *
24915  * \sa Ast::get_node_name
24916  */
24917  std::string get_node_type_name() const noexcept override { return "Sens"; }
24918 
24919  /**
24920  * \brief Return NMODL statement of ast node as std::string
24921  *
24922  * Every node is related to a special statement in the NMODL. This
24923  * statement can be returned as a std::string for printing to
24924  * text/json form.
24925  *
24926  * \return name of the statement as a string i.e. "SENS "
24927  *
24928  * \sa Ast::get_nmodl_name
24929  */
24930  std::string get_nmodl_name() const noexcept override { return "SENS "; }
24931 
24932  /**
24933  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24934  */
24935  std::shared_ptr<Ast> get_shared_ptr() override {
24936  return std::static_pointer_cast<Sens>(shared_from_this());
24937  }
24938 
24939  /**
24940  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24941  */
24942  std::shared_ptr<const Ast> get_shared_ptr() const override {
24943  return std::static_pointer_cast<const Sens>(shared_from_this());
24944  }
24945 
24946  /**
24947  * \brief Return associated token for the current ast node
24948  *
24949  * Not all ast nodes have token information. For example,
24950  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
24951  * solution of ODEs. In this case, we return nullptr to store in the
24952  * nmodl::symtab::SymbolTable.
24953  *
24954  * \return pointer to token if exist otherwise nullptr
24955  */
24956  const ModToken *get_token() const noexcept override { return token.get(); }
24957 
24958  /**
24959  * \brief Getter for member variable \ref Sens.variables
24960  */
24961  const VarNameVector &get_variables() const noexcept { return variables; }
24962 
24963  /// \}
24964 
24965  /// \name Setters
24966  /// \{
24967 
24968  /**
24969  * \brief Set token for the current ast node
24970  */
24971  void set_token(const ModToken &tok) {
24972  token = std::make_shared<ModToken>(tok);
24973  }
24974 
24975  /**
24976  * \brief Setter for member variable \ref Sens.variables (rvalue reference)
24977  */
24978  void set_variables(VarNameVector &&variables);
24979 
24980  /**
24981  * \brief Setter for member variable \ref Sens.variables
24982  */
24983  void set_variables(const VarNameVector &variables);
24984 
24985  /// \}
24986 
24987  /// \name Visitor
24988  /// \{
24989 
24990  /**
24991  * \brief visit children i.e. member variables of current node using provided
24992  * visitor
24993  *
24994  * Different nodes in the AST have different members (i.e. children). This
24995  * method recursively visits children using provided visitor.
24996  *
24997  * \param v Concrete visitor that will be used to recursively visit children
24998  *
24999  * \sa Ast::visit_children for example.
25000  */
25001  void visit_children(visitor::Visitor &v) override;
25002 
25003  /**
25004  * \brief accept (or visit) the current AST node using provided visitor
25005  *
25006  * Instead of visiting children of AST node, like Ast::visit_children,
25007  * accept allows to visit the current node itself using provided concrete
25008  * visitor.
25009  *
25010  * \param v Concrete visitor that will be used to recursively visit node
25011  *
25012  * \sa Ast::accept for example.
25013  */
25014  void accept(visitor::Visitor &v) override;
25015 
25016  /// \}
25017 
25018 private:
25019  /**
25020  * \brief Set this object as parent for all the children
25021  *
25022  * This should be called in every object (with children) constructor
25023  * to set parents. Since it is called only in the constructors it
25024  * should not be virtual to avoid ambiguities (issue #295).
25025  */
25026  void set_parent_in_children();
25027 };
25028 
25029 /** @} */ // end of ast_class
25030 
25031 } // namespace ast
25032 } // namespace nmodl
25033 #endif // !NMODL_AST_SENS_HPP
25034 #ifndef NMODL_AST_CONSERVE_HPP
25035 #define NMODL_AST_CONSERVE_HPP
25036 
25037 namespace nmodl {
25038 namespace ast {
25039 
25040 /**
25041  * @addtogroup ast_class
25042  * @ingroup ast
25043  * @{
25044  */
25045 
25046 /**
25047  * \brief Represent CONSERVE statement in NMODL
25048  *
25049  *
25050  */
25051 class Conserve : public Statement {
25052 private:
25053  /// TODO
25054  std::shared_ptr<Expression> react;
25055  /// TODO
25056  std::shared_ptr<Expression> expr;
25057  /// token with location information
25058  std::shared_ptr<ModToken> token;
25059 
25060 public:
25061  /// \name Ctor & dtor
25062  /// \{
25063 
25064  explicit Conserve(Expression *react, Expression *expr);
25065  explicit Conserve(const std::shared_ptr<Expression> &react,
25066  const std::shared_ptr<Expression> &expr);
25067  Conserve(const Conserve &obj);
25068 
25069  virtual ~Conserve() = default;
25070 
25071  /// \}
25072 
25073  /**
25074  * \brief Check if the ast node is an instance of ast::Conserve
25075  * \return true as object is of type ast::Conserve
25076  */
25077  bool is_conserve() const noexcept override { return true; }
25078 
25079  /**
25080  * \brief Return a copy of the current node
25081  *
25082  * Recursively make a new copy/clone of the current node including
25083  * all members and return a pointer to the node. This is used for
25084  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25085  * ast.
25086  *
25087  * @return pointer to the clone/copy of the current node
25088  */
25089  Conserve *clone() const override { return new Conserve(*this); }
25090 
25091  /// \name Getters
25092  /// \{
25093 
25094  /**
25095  * \brief Return type (ast::AstNodeType) of ast node
25096  *
25097  * Every node in the ast has a type defined in ast::AstNodeType and this
25098  * function is used to retrieve the same.
25099  *
25100  * \return ast node type i.e. ast::AstNodeType::CONSERVE
25101  *
25102  * \sa Ast::get_node_type_name
25103  */
25104  AstNodeType get_node_type() const noexcept override {
25105  return AstNodeType::CONSERVE;
25106  }
25107 
25108  /**
25109  * \brief Return type (ast::AstNodeType) of ast node as std::string
25110  *
25111  * Every node in the ast has a type defined in ast::AstNodeType.
25112  * This type name can be returned as a std::string for printing
25113  * node to text/json form.
25114  *
25115  * \return name of the node type as a string i.e. "Conserve"
25116  *
25117  * \sa Ast::get_node_name
25118  */
25119  std::string get_node_type_name() const noexcept override {
25120  return "Conserve";
25121  }
25122 
25123  /**
25124  * \brief Return NMODL statement of ast node as std::string
25125  *
25126  * Every node is related to a special statement in the NMODL. This
25127  * statement can be returned as a std::string for printing to
25128  * text/json form.
25129  *
25130  * \return name of the statement as a string i.e. "CONSERVE"
25131  *
25132  * \sa Ast::get_nmodl_name
25133  */
25134  std::string get_nmodl_name() const noexcept override { return "CONSERVE"; }
25135 
25136  /**
25137  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25138  */
25139  std::shared_ptr<Ast> get_shared_ptr() override {
25140  return std::static_pointer_cast<Conserve>(shared_from_this());
25141  }
25142 
25143  /**
25144  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25145  */
25146  std::shared_ptr<const Ast> get_shared_ptr() const override {
25147  return std::static_pointer_cast<const Conserve>(shared_from_this());
25148  }
25149 
25150  /**
25151  * \brief Return associated token for the current ast node
25152  *
25153  * Not all ast nodes have token information. For example,
25154  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
25155  * solution of ODEs. In this case, we return nullptr to store in the
25156  * nmodl::symtab::SymbolTable.
25157  *
25158  * \return pointer to token if exist otherwise nullptr
25159  */
25160  const ModToken *get_token() const noexcept override { return token.get(); }
25161 
25162  /**
25163  * \brief Getter for member variable \ref Conserve.react
25164  */
25165  const std::shared_ptr<Expression> &get_react() const noexcept {
25166  return react;
25167  }
25168 
25169  /**
25170  * \brief Getter for member variable \ref Conserve.expr
25171  */
25172  const std::shared_ptr<Expression> &get_expr() const noexcept { return expr; }
25173 
25174  /// \}
25175 
25176  /// \name Setters
25177  /// \{
25178 
25179  /**
25180  * \brief Set token for the current ast node
25181  */
25182  void set_token(const ModToken &tok) {
25183  token = std::make_shared<ModToken>(tok);
25184  }
25185 
25186  /**
25187  * \brief Setter for member variable \ref Conserve.react (rvalue reference)
25188  */
25189  void set_react(std::shared_ptr<Expression> &&react);
25190 
25191  /**
25192  * \brief Setter for member variable \ref Conserve.react
25193  */
25194  void set_react(const std::shared_ptr<Expression> &react);
25195 
25196  /**
25197  * \brief Setter for member variable \ref Conserve.expr (rvalue reference)
25198  */
25199  void set_expr(std::shared_ptr<Expression> &&expr);
25200 
25201  /**
25202  * \brief Setter for member variable \ref Conserve.expr
25203  */
25204  void set_expr(const std::shared_ptr<Expression> &expr);
25205 
25206  /// \}
25207 
25208  /// \name Visitor
25209  /// \{
25210 
25211  /**
25212  * \brief visit children i.e. member variables of current node using provided
25213  * visitor
25214  *
25215  * Different nodes in the AST have different members (i.e. children). This
25216  * method recursively visits children using provided visitor.
25217  *
25218  * \param v Concrete visitor that will be used to recursively visit children
25219  *
25220  * \sa Ast::visit_children for example.
25221  */
25222  void visit_children(visitor::Visitor &v) override;
25223 
25224  /**
25225  * \brief accept (or visit) the current AST node using provided visitor
25226  *
25227  * Instead of visiting children of AST node, like Ast::visit_children,
25228  * accept allows to visit the current node itself using provided concrete
25229  * visitor.
25230  *
25231  * \param v Concrete visitor that will be used to recursively visit node
25232  *
25233  * \sa Ast::accept for example.
25234  */
25235  void accept(visitor::Visitor &v) override;
25236 
25237  /// \}
25238 
25239 private:
25240  /**
25241  * \brief Set this object as parent for all the children
25242  *
25243  * This should be called in every object (with children) constructor
25244  * to set parents. Since it is called only in the constructors it
25245  * should not be virtual to avoid ambiguities (issue #295).
25246  */
25247  void set_parent_in_children();
25248 };
25249 
25250 /** @} */ // end of ast_class
25251 
25252 } // namespace ast
25253 } // namespace nmodl
25254 #endif // !NMODL_AST_CONSERVE_HPP
25255 #ifndef NMODL_AST_COMPARTMENT_HPP
25256 #define NMODL_AST_COMPARTMENT_HPP
25257 
25258 namespace nmodl {
25259 namespace ast {
25260 
25261 /**
25262  * @addtogroup ast_class
25263  * @ingroup ast
25264  * @{
25265  */
25266 
25267 /**
25268  * \brief Represent COMPARTMENT statement in NMODL
25269  *
25270  *
25271  */
25272 class Compartment : public Statement {
25273 private:
25274  /// TODO
25275  std::shared_ptr<Name> name;
25276  /// TODO
25277  std::shared_ptr<Expression> expression;
25278  /// TODO
25280  /// token with location information
25281  std::shared_ptr<ModToken> token;
25282 
25283 public:
25284  /// \name Ctor & dtor
25285  /// \{
25286 
25287  explicit Compartment(Name *name, Expression *expression, NameVector names);
25288  explicit Compartment(const std::shared_ptr<Name> &name,
25289  const std::shared_ptr<Expression> &expression,
25290  const NameVector &names);
25291  Compartment(const Compartment &obj);
25292 
25293  virtual ~Compartment() = default;
25294 
25295  /// \}
25296 
25297  /**
25298  * \brief Check if the ast node is an instance of ast::Compartment
25299  * \return true as object is of type ast::Compartment
25300  */
25301  bool is_compartment() const noexcept override { return true; }
25302 
25303  /**
25304  * \brief Return a copy of the current node
25305  *
25306  * Recursively make a new copy/clone of the current node including
25307  * all members and return a pointer to the node. This is used for
25308  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25309  * ast.
25310  *
25311  * @return pointer to the clone/copy of the current node
25312  */
25313  Compartment *clone() const override { return new Compartment(*this); }
25314 
25315  /// \name Getters
25316  /// \{
25317 
25318  /**
25319  * \brief Return type (ast::AstNodeType) of ast node
25320  *
25321  * Every node in the ast has a type defined in ast::AstNodeType and this
25322  * function is used to retrieve the same.
25323  *
25324  * \return ast node type i.e. ast::AstNodeType::COMPARTMENT
25325  *
25326  * \sa Ast::get_node_type_name
25327  */
25328  AstNodeType get_node_type() const noexcept override {
25329  return AstNodeType::COMPARTMENT;
25330  }
25331 
25332  /**
25333  * \brief Return type (ast::AstNodeType) of ast node as std::string
25334  *
25335  * Every node in the ast has a type defined in ast::AstNodeType.
25336  * This type name can be returned as a std::string for printing
25337  * node to text/json form.
25338  *
25339  * \return name of the node type as a string i.e. "Compartment"
25340  *
25341  * \sa Ast::get_node_name
25342  */
25343  std::string get_node_type_name() const noexcept override {
25344  return "Compartment";
25345  }
25346 
25347  /**
25348  * \brief Return NMODL statement of ast node as std::string
25349  *
25350  * Every node is related to a special statement in the NMODL. This
25351  * statement can be returned as a std::string for printing to
25352  * text/json form.
25353  *
25354  * \return name of the statement as a string i.e. "COMPARTMENT"
25355  *
25356  * \sa Ast::get_nmodl_name
25357  */
25358  std::string get_nmodl_name() const noexcept override { return "COMPARTMENT"; }
25359 
25360  /**
25361  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25362  */
25363  std::shared_ptr<Ast> get_shared_ptr() override {
25364  return std::static_pointer_cast<Compartment>(shared_from_this());
25365  }
25366 
25367  /**
25368  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25369  */
25370  std::shared_ptr<const Ast> get_shared_ptr() const override {
25371  return std::static_pointer_cast<const Compartment>(shared_from_this());
25372  }
25373 
25374  /**
25375  * \brief Return associated token for the current ast node
25376  *
25377  * Not all ast nodes have token information. For example,
25378  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
25379  * solution of ODEs. In this case, we return nullptr to store in the
25380  * nmodl::symtab::SymbolTable.
25381  *
25382  * \return pointer to token if exist otherwise nullptr
25383  */
25384  const ModToken *get_token() const noexcept override { return token.get(); }
25385 
25386  /**
25387  * \brief Getter for member variable \ref Compartment.name
25388  */
25389  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
25390 
25391  /**
25392  * \brief Getter for member variable \ref Compartment.expression
25393  */
25394  const std::shared_ptr<Expression> &get_expression() const noexcept {
25395  return expression;
25396  }
25397 
25398  /**
25399  * \brief Getter for member variable \ref Compartment.names
25400  */
25401  const NameVector &get_names() const noexcept { return names; }
25402 
25403  /// \}
25404 
25405  /// \name Setters
25406  /// \{
25407 
25408  /**
25409  * \brief Set token for the current ast node
25410  */
25411  void set_token(const ModToken &tok) {
25412  token = std::make_shared<ModToken>(tok);
25413  }
25414 
25415  /**
25416  * \brief Setter for member variable \ref Compartment.name (rvalue reference)
25417  */
25418  void set_name(std::shared_ptr<Name> &&name);
25419 
25420  /**
25421  * \brief Setter for member variable \ref Compartment.name
25422  */
25423  void set_name(const std::shared_ptr<Name> &name);
25424 
25425  /**
25426  * \brief Setter for member variable \ref Compartment.expression (rvalue
25427  * reference)
25428  */
25429  void set_expression(std::shared_ptr<Expression> &&expression);
25430 
25431  /**
25432  * \brief Setter for member variable \ref Compartment.expression
25433  */
25434  void set_expression(const std::shared_ptr<Expression> &expression);
25435 
25436  /**
25437  * \brief Setter for member variable \ref Compartment.names (rvalue reference)
25438  */
25439  void set_names(NameVector &&names);
25440 
25441  /**
25442  * \brief Setter for member variable \ref Compartment.names
25443  */
25444  void set_names(const NameVector &names);
25445 
25446  /// \}
25447 
25448  /// \name Visitor
25449  /// \{
25450 
25451  /**
25452  * \brief visit children i.e. member variables of current node using provided
25453  * visitor
25454  *
25455  * Different nodes in the AST have different members (i.e. children). This
25456  * method recursively visits children using provided visitor.
25457  *
25458  * \param v Concrete visitor that will be used to recursively visit children
25459  *
25460  * \sa Ast::visit_children for example.
25461  */
25462  void visit_children(visitor::Visitor &v) override;
25463 
25464  /**
25465  * \brief accept (or visit) the current AST node using provided visitor
25466  *
25467  * Instead of visiting children of AST node, like Ast::visit_children,
25468  * accept allows to visit the current node itself using provided concrete
25469  * visitor.
25470  *
25471  * \param v Concrete visitor that will be used to recursively visit node
25472  *
25473  * \sa Ast::accept for example.
25474  */
25475  void accept(visitor::Visitor &v) override;
25476 
25477  /// \}
25478 
25479 private:
25480  /**
25481  * \brief Set this object as parent for all the children
25482  *
25483  * This should be called in every object (with children) constructor
25484  * to set parents. Since it is called only in the constructors it
25485  * should not be virtual to avoid ambiguities (issue #295).
25486  */
25487  void set_parent_in_children();
25488 };
25489 
25490 /** @} */ // end of ast_class
25491 
25492 } // namespace ast
25493 } // namespace nmodl
25494 #endif // !NMODL_AST_COMPARTMENT_HPP
25495 #ifndef NMODL_AST_LON_DIFUSE_HPP
25496 #define NMODL_AST_LON_DIFUSE_HPP
25497 
25498 namespace nmodl {
25499 namespace ast {
25500 
25501 /**
25502  * @addtogroup ast_class
25503  * @ingroup ast
25504  * @{
25505  */
25506 
25507 /**
25508  * \brief Represent LONGITUDINAL_DIFFUSION statement in NMODL
25509  *
25510  *
25511  */
25512 class LonDifuse : public Statement {
25513 private:
25514  /// TODO
25515  std::shared_ptr<Name> name;
25516  /// TODO
25517  std::shared_ptr<Expression> expression;
25518  /// TODO
25520  /// token with location information
25521  std::shared_ptr<ModToken> token;
25522 
25523 public:
25524  /// \name Ctor & dtor
25525  /// \{
25526 
25527  explicit LonDifuse(Name *name, Expression *expression, NameVector names);
25528  explicit LonDifuse(const std::shared_ptr<Name> &name,
25529  const std::shared_ptr<Expression> &expression,
25530  const NameVector &names);
25531  LonDifuse(const LonDifuse &obj);
25532 
25533  virtual ~LonDifuse() = default;
25534 
25535  /// \}
25536 
25537  /**
25538  * \brief Check if the ast node is an instance of ast::LonDifuse
25539  * \return true as object is of type ast::LonDifuse
25540  */
25541  bool is_lon_difuse() const noexcept override { return true; }
25542 
25543  /**
25544  * \brief Return a copy of the current node
25545  *
25546  * Recursively make a new copy/clone of the current node including
25547  * all members and return a pointer to the node. This is used for
25548  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25549  * ast.
25550  *
25551  * @return pointer to the clone/copy of the current node
25552  */
25553  LonDifuse *clone() const override { return new LonDifuse(*this); }
25554 
25555  /// \name Getters
25556  /// \{
25557 
25558  /**
25559  * \brief Return type (ast::AstNodeType) of ast node
25560  *
25561  * Every node in the ast has a type defined in ast::AstNodeType and this
25562  * function is used to retrieve the same.
25563  *
25564  * \return ast node type i.e. ast::AstNodeType::LON_DIFUSE
25565  *
25566  * \sa Ast::get_node_type_name
25567  */
25568  AstNodeType get_node_type() const noexcept override {
25569  return AstNodeType::LON_DIFUSE;
25570  }
25571 
25572  /**
25573  * \brief Return type (ast::AstNodeType) of ast node as std::string
25574  *
25575  * Every node in the ast has a type defined in ast::AstNodeType.
25576  * This type name can be returned as a std::string for printing
25577  * node to text/json form.
25578  *
25579  * \return name of the node type as a string i.e. "LonDifuse"
25580  *
25581  * \sa Ast::get_node_name
25582  */
25583  std::string get_node_type_name() const noexcept override {
25584  return "LonDifuse";
25585  }
25586 
25587  /**
25588  * \brief Return NMODL statement of ast node as std::string
25589  *
25590  * Every node is related to a special statement in the NMODL. This
25591  * statement can be returned as a std::string for printing to
25592  * text/json form.
25593  *
25594  * \return name of the statement as a string i.e. "LONGITUDINAL_DIFFUSION"
25595  *
25596  * \sa Ast::get_nmodl_name
25597  */
25598  std::string get_nmodl_name() const noexcept override {
25599  return "LONGITUDINAL_DIFFUSION";
25600  }
25601 
25602  /**
25603  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25604  */
25605  std::shared_ptr<Ast> get_shared_ptr() override {
25606  return std::static_pointer_cast<LonDifuse>(shared_from_this());
25607  }
25608 
25609  /**
25610  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25611  */
25612  std::shared_ptr<const Ast> get_shared_ptr() const override {
25613  return std::static_pointer_cast<const LonDifuse>(shared_from_this());
25614  }
25615 
25616  /**
25617  * \brief Return associated token for the current ast node
25618  *
25619  * Not all ast nodes have token information. For example,
25620  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
25621  * solution of ODEs. In this case, we return nullptr to store in the
25622  * nmodl::symtab::SymbolTable.
25623  *
25624  * \return pointer to token if exist otherwise nullptr
25625  */
25626  const ModToken *get_token() const noexcept override { return token.get(); }
25627 
25628  /**
25629  * \brief Getter for member variable \ref LonDifuse.name
25630  */
25631  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
25632 
25633  /**
25634  * \brief Getter for member variable \ref LonDifuse.expression
25635  */
25636  const std::shared_ptr<Expression> &get_expression() const noexcept {
25637  return expression;
25638  }
25639 
25640  /**
25641  * \brief Getter for member variable \ref LonDifuse.names
25642  */
25643  const NameVector &get_names() const noexcept { return names; }
25644 
25645  /// \}
25646 
25647  /// \name Setters
25648  /// \{
25649 
25650  /**
25651  * \brief Set token for the current ast node
25652  */
25653  void set_token(const ModToken &tok) {
25654  token = std::make_shared<ModToken>(tok);
25655  }
25656 
25657  /**
25658  * \brief Setter for member variable \ref LonDifuse.name (rvalue reference)
25659  */
25660  void set_name(std::shared_ptr<Name> &&name);
25661 
25662  /**
25663  * \brief Setter for member variable \ref LonDifuse.name
25664  */
25665  void set_name(const std::shared_ptr<Name> &name);
25666 
25667  /**
25668  * \brief Setter for member variable \ref LonDifuse.expression (rvalue
25669  * reference)
25670  */
25671  void set_expression(std::shared_ptr<Expression> &&expression);
25672 
25673  /**
25674  * \brief Setter for member variable \ref LonDifuse.expression
25675  */
25676  void set_expression(const std::shared_ptr<Expression> &expression);
25677 
25678  /**
25679  * \brief Setter for member variable \ref LonDifuse.names (rvalue reference)
25680  */
25681  void set_names(NameVector &&names);
25682 
25683  /**
25684  * \brief Setter for member variable \ref LonDifuse.names
25685  */
25686  void set_names(const NameVector &names);
25687 
25688  /// \}
25689 
25690  /// \name Visitor
25691  /// \{
25692 
25693  /**
25694  * \brief visit children i.e. member variables of current node using provided
25695  * visitor
25696  *
25697  * Different nodes in the AST have different members (i.e. children). This
25698  * method recursively visits children using provided visitor.
25699  *
25700  * \param v Concrete visitor that will be used to recursively visit children
25701  *
25702  * \sa Ast::visit_children for example.
25703  */
25704  void visit_children(visitor::Visitor &v) override;
25705 
25706  /**
25707  * \brief accept (or visit) the current AST node using provided visitor
25708  *
25709  * Instead of visiting children of AST node, like Ast::visit_children,
25710  * accept allows to visit the current node itself using provided concrete
25711  * visitor.
25712  *
25713  * \param v Concrete visitor that will be used to recursively visit node
25714  *
25715  * \sa Ast::accept for example.
25716  */
25717  void accept(visitor::Visitor &v) override;
25718 
25719  /// \}
25720 
25721 private:
25722  /**
25723  * \brief Set this object as parent for all the children
25724  *
25725  * This should be called in every object (with children) constructor
25726  * to set parents. Since it is called only in the constructors it
25727  * should not be virtual to avoid ambiguities (issue #295).
25728  */
25729  void set_parent_in_children();
25730 };
25731 
25732 /** @} */ // end of ast_class
25733 
25734 } // namespace ast
25735 } // namespace nmodl
25736 #endif // !NMODL_AST_LON_DIFUSE_HPP
25737 #ifndef NMODL_AST_REACTION_STATEMENT_HPP
25738 #define NMODL_AST_REACTION_STATEMENT_HPP
25739 
25740 namespace nmodl {
25741 namespace ast {
25742 
25743 /**
25744  * @addtogroup ast_class
25745  * @ingroup ast
25746  * @{
25747  */
25748 
25749 /**
25750  * \brief TODO
25751  *
25752  *
25753  */
25755 private:
25756  /// TODO
25757  std::shared_ptr<Expression> reaction1;
25758  /// TODO
25760  /// TODO
25761  std::shared_ptr<Expression> reaction2;
25762  /// TODO
25763  std::shared_ptr<Expression> expression1;
25764  /// TODO
25765  std::shared_ptr<Expression> expression2;
25766  /// token with location information
25767  std::shared_ptr<ModToken> token;
25768 
25769 public:
25770  /// \name Ctor & dtor
25771  /// \{
25772 
25773  explicit ReactionStatement(Expression *reaction1, const ReactionOperator &op,
25774  Expression *reaction2, Expression *expression1,
25775  Expression *expression2);
25776  explicit ReactionStatement(const std::shared_ptr<Expression> &reaction1,
25777  const ReactionOperator &op,
25778  const std::shared_ptr<Expression> &reaction2,
25779  const std::shared_ptr<Expression> &expression1,
25780  const std::shared_ptr<Expression> &expression2);
25782 
25783  virtual ~ReactionStatement() = default;
25784 
25785  /// \}
25786 
25787  /**
25788  * \brief Check if the ast node is an instance of ast::ReactionStatement
25789  * \return true as object is of type ast::ReactionStatement
25790  */
25791  bool is_reaction_statement() const noexcept override { return true; }
25792 
25793  /**
25794  * \brief Return a copy of the current node
25795  *
25796  * Recursively make a new copy/clone of the current node including
25797  * all members and return a pointer to the node. This is used for
25798  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25799  * ast.
25800  *
25801  * @return pointer to the clone/copy of the current node
25802  */
25803  ReactionStatement *clone() const override {
25804  return new ReactionStatement(*this);
25805  }
25806 
25807  /// \name Getters
25808  /// \{
25809 
25810  /**
25811  * \brief Return type (ast::AstNodeType) of ast node
25812  *
25813  * Every node in the ast has a type defined in ast::AstNodeType and this
25814  * function is used to retrieve the same.
25815  *
25816  * \return ast node type i.e. ast::AstNodeType::REACTION_STATEMENT
25817  *
25818  * \sa Ast::get_node_type_name
25819  */
25820  AstNodeType get_node_type() const noexcept override {
25822  }
25823 
25824  /**
25825  * \brief Return type (ast::AstNodeType) of ast node as std::string
25826  *
25827  * Every node in the ast has a type defined in ast::AstNodeType.
25828  * This type name can be returned as a std::string for printing
25829  * node to text/json form.
25830  *
25831  * \return name of the node type as a string i.e. "ReactionStatement"
25832  *
25833  * \sa Ast::get_node_name
25834  */
25835  std::string get_node_type_name() const noexcept override {
25836  return "ReactionStatement";
25837  }
25838 
25839  /**
25840  * \brief Return NMODL statement of ast node as std::string
25841  *
25842  * Every node is related to a special statement in the NMODL. This
25843  * statement can be returned as a std::string for printing to
25844  * text/json form.
25845  *
25846  * \return name of the statement as a string i.e. "~ "
25847  *
25848  * \sa Ast::get_nmodl_name
25849  */
25850  std::string get_nmodl_name() const noexcept override { return "~ "; }
25851 
25852  /**
25853  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25854  */
25855  std::shared_ptr<Ast> get_shared_ptr() override {
25856  return std::static_pointer_cast<ReactionStatement>(shared_from_this());
25857  }
25858 
25859  /**
25860  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25861  */
25862  std::shared_ptr<const Ast> get_shared_ptr() const override {
25863  return std::static_pointer_cast<const ReactionStatement>(
25864  shared_from_this());
25865  }
25866 
25867  /**
25868  * \brief Return associated token for the current ast node
25869  *
25870  * Not all ast nodes have token information. For example,
25871  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
25872  * solution of ODEs. In this case, we return nullptr to store in the
25873  * nmodl::symtab::SymbolTable.
25874  *
25875  * \return pointer to token if exist otherwise nullptr
25876  */
25877  const ModToken *get_token() const noexcept override { return token.get(); }
25878 
25879  /**
25880  * \brief Getter for member variable \ref ReactionStatement.reaction1
25881  */
25882  const std::shared_ptr<Expression> &get_reaction1() const noexcept {
25883  return reaction1;
25884  }
25885 
25886  /**
25887  * \brief Getter for member variable \ref ReactionStatement.op
25888  */
25889  const ReactionOperator &get_op() const noexcept { return op; }
25890 
25891  /**
25892  * \brief Getter for member variable \ref ReactionStatement.reaction2
25893  */
25894  const std::shared_ptr<Expression> &get_reaction2() const noexcept {
25895  return reaction2;
25896  }
25897 
25898  /**
25899  * \brief Getter for member variable \ref ReactionStatement.expression1
25900  */
25901  const std::shared_ptr<Expression> &get_expression1() const noexcept {
25902  return expression1;
25903  }
25904 
25905  /**
25906  * \brief Getter for member variable \ref ReactionStatement.expression2
25907  */
25908  const std::shared_ptr<Expression> &get_expression2() const noexcept {
25909  return expression2;
25910  }
25911 
25912  /// \}
25913 
25914  /// \name Setters
25915  /// \{
25916 
25917  /**
25918  * \brief Set token for the current ast node
25919  */
25920  void set_token(const ModToken &tok) {
25921  token = std::make_shared<ModToken>(tok);
25922  }
25923 
25924  /**
25925  * \brief Setter for member variable \ref ReactionStatement.reaction1 (rvalue
25926  * reference)
25927  */
25928  void set_reaction1(std::shared_ptr<Expression> &&reaction1);
25929 
25930  /**
25931  * \brief Setter for member variable \ref ReactionStatement.reaction1
25932  */
25933  void set_reaction1(const std::shared_ptr<Expression> &reaction1);
25934 
25935  /**
25936  * \brief Setter for member variable \ref ReactionStatement.op (rvalue
25937  * reference)
25938  */
25939  void set_op(ReactionOperator &&op);
25940 
25941  /**
25942  * \brief Setter for member variable \ref ReactionStatement.op
25943  */
25944  void set_op(const ReactionOperator &op);
25945 
25946  /**
25947  * \brief Setter for member variable \ref ReactionStatement.reaction2 (rvalue
25948  * reference)
25949  */
25950  void set_reaction2(std::shared_ptr<Expression> &&reaction2);
25951 
25952  /**
25953  * \brief Setter for member variable \ref ReactionStatement.reaction2
25954  */
25955  void set_reaction2(const std::shared_ptr<Expression> &reaction2);
25956 
25957  /**
25958  * \brief Setter for member variable \ref ReactionStatement.expression1
25959  * (rvalue reference)
25960  */
25961  void set_expression1(std::shared_ptr<Expression> &&expression1);
25962 
25963  /**
25964  * \brief Setter for member variable \ref ReactionStatement.expression1
25965  */
25966  void set_expression1(const std::shared_ptr<Expression> &expression1);
25967 
25968  /**
25969  * \brief Setter for member variable \ref ReactionStatement.expression2
25970  * (rvalue reference)
25971  */
25972  void set_expression2(std::shared_ptr<Expression> &&expression2);
25973 
25974  /**
25975  * \brief Setter for member variable \ref ReactionStatement.expression2
25976  */
25977  void set_expression2(const std::shared_ptr<Expression> &expression2);
25978 
25979  /// \}
25980 
25981  /// \name Visitor
25982  /// \{
25983 
25984  /**
25985  * \brief visit children i.e. member variables of current node using provided
25986  * visitor
25987  *
25988  * Different nodes in the AST have different members (i.e. children). This
25989  * method recursively visits children using provided visitor.
25990  *
25991  * \param v Concrete visitor that will be used to recursively visit children
25992  *
25993  * \sa Ast::visit_children for example.
25994  */
25995  void visit_children(visitor::Visitor &v) override;
25996 
25997  /**
25998  * \brief accept (or visit) the current AST node using provided visitor
25999  *
26000  * Instead of visiting children of AST node, like Ast::visit_children,
26001  * accept allows to visit the current node itself using provided concrete
26002  * visitor.
26003  *
26004  * \param v Concrete visitor that will be used to recursively visit node
26005  *
26006  * \sa Ast::accept for example.
26007  */
26008  void accept(visitor::Visitor &v) override;
26009 
26010  /// \}
26011 
26012 private:
26013  /**
26014  * \brief Set this object as parent for all the children
26015  *
26016  * This should be called in every object (with children) constructor
26017  * to set parents. Since it is called only in the constructors it
26018  * should not be virtual to avoid ambiguities (issue #295).
26019  */
26020  void set_parent_in_children();
26021 };
26022 
26023 /** @} */ // end of ast_class
26024 
26025 } // namespace ast
26026 } // namespace nmodl
26027 #endif // !NMODL_AST_REACTION_STATEMENT_HPP
26028 #ifndef NMODL_AST_LAG_STATEMENT_HPP
26029 #define NMODL_AST_LAG_STATEMENT_HPP
26030 
26031 namespace nmodl {
26032 namespace ast {
26033 
26034 /**
26035  * @addtogroup ast_class
26036  * @ingroup ast
26037  * @{
26038  */
26039 
26040 /**
26041  * \brief Represents a LAG statement in the mod file
26042  *
26043  * An example of LAG statement usage:
26044  *
26045  * \code{.mod}
26046  * PROCEDURE lates() {
26047  * LAG ina BY tau
26048  * neo = lag_ina_tau
26049  * if (ena < 70) {ena = 70}
26050  * }
26051  * \endcode
26052  *
26053  */
26054 class LagStatement : public Statement {
26055 private:
26056  /// Name of the variable (TODO)
26057  std::shared_ptr<Identifier> name;
26058  /// Name of the variable (TODO)
26059  std::shared_ptr<Name> byname;
26060  /// token with location information
26061  std::shared_ptr<ModToken> token;
26062 
26063 public:
26064  /// \name Ctor & dtor
26065  /// \{
26066 
26067  explicit LagStatement(Identifier *name, Name *byname);
26068  explicit LagStatement(const std::shared_ptr<Identifier> &name,
26069  const std::shared_ptr<Name> &byname);
26070  LagStatement(const LagStatement &obj);
26071 
26072  virtual ~LagStatement() = default;
26073 
26074  /// \}
26075 
26076  /**
26077  * \brief Check if the ast node is an instance of ast::LagStatement
26078  * \return true as object is of type ast::LagStatement
26079  */
26080  bool is_lag_statement() const noexcept override { return true; }
26081 
26082  /**
26083  * \brief Return a copy of the current node
26084  *
26085  * Recursively make a new copy/clone of the current node including
26086  * all members and return a pointer to the node. This is used for
26087  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26088  * ast.
26089  *
26090  * @return pointer to the clone/copy of the current node
26091  */
26092  LagStatement *clone() const override { return new LagStatement(*this); }
26093 
26094  /// \name Getters
26095  /// \{
26096 
26097  /**
26098  * \brief Return type (ast::AstNodeType) of ast node
26099  *
26100  * Every node in the ast has a type defined in ast::AstNodeType and this
26101  * function is used to retrieve the same.
26102  *
26103  * \return ast node type i.e. ast::AstNodeType::LAG_STATEMENT
26104  *
26105  * \sa Ast::get_node_type_name
26106  */
26107  AstNodeType get_node_type() const noexcept override {
26109  }
26110 
26111  /**
26112  * \brief Return type (ast::AstNodeType) of ast node as std::string
26113  *
26114  * Every node in the ast has a type defined in ast::AstNodeType.
26115  * This type name can be returned as a std::string for printing
26116  * node to text/json form.
26117  *
26118  * \return name of the node type as a string i.e. "LagStatement"
26119  *
26120  * \sa Ast::get_node_name
26121  */
26122  std::string get_node_type_name() const noexcept override {
26123  return "LagStatement";
26124  }
26125 
26126  /**
26127  * \brief Return NMODL statement of ast node as std::string
26128  *
26129  * Every node is related to a special statement in the NMODL. This
26130  * statement can be returned as a std::string for printing to
26131  * text/json form.
26132  *
26133  * \return name of the statement as a string i.e. "LAG "
26134  *
26135  * \sa Ast::get_nmodl_name
26136  */
26137  std::string get_nmodl_name() const noexcept override { return "LAG "; }
26138 
26139  /**
26140  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26141  */
26142  std::shared_ptr<Ast> get_shared_ptr() override {
26143  return std::static_pointer_cast<LagStatement>(shared_from_this());
26144  }
26145 
26146  /**
26147  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26148  */
26149  std::shared_ptr<const Ast> get_shared_ptr() const override {
26150  return std::static_pointer_cast<const LagStatement>(shared_from_this());
26151  }
26152 
26153  /**
26154  * \brief Return associated token for the current ast node
26155  *
26156  * Not all ast nodes have token information. For example,
26157  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
26158  * solution of ODEs. In this case, we return nullptr to store in the
26159  * nmodl::symtab::SymbolTable.
26160  *
26161  * \return pointer to token if exist otherwise nullptr
26162  */
26163  const ModToken *get_token() const noexcept override { return token.get(); }
26164 
26165  /**
26166  * \brief Getter for member variable \ref LagStatement.name
26167  */
26168  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
26169 
26170  /**
26171  * \brief Getter for member variable \ref LagStatement.byname
26172  */
26173  const std::shared_ptr<Name> &get_byname() const noexcept { return byname; }
26174 
26175  /// \}
26176 
26177  /// \name Setters
26178  /// \{
26179 
26180  /**
26181  * \brief Set token for the current ast node
26182  */
26183  void set_token(const ModToken &tok) {
26184  token = std::make_shared<ModToken>(tok);
26185  }
26186 
26187  /**
26188  * \brief Setter for member variable \ref LagStatement.name (rvalue reference)
26189  */
26190  void set_name(std::shared_ptr<Identifier> &&name);
26191 
26192  /**
26193  * \brief Setter for member variable \ref LagStatement.name
26194  */
26195  void set_name(const std::shared_ptr<Identifier> &name);
26196 
26197  /**
26198  * \brief Setter for member variable \ref LagStatement.byname (rvalue
26199  * reference)
26200  */
26201  void set_byname(std::shared_ptr<Name> &&byname);
26202 
26203  /**
26204  * \brief Setter for member variable \ref LagStatement.byname
26205  */
26206  void set_byname(const std::shared_ptr<Name> &byname);
26207 
26208  /// \}
26209 
26210  /// \name Visitor
26211  /// \{
26212 
26213  /**
26214  * \brief visit children i.e. member variables of current node using provided
26215  * visitor
26216  *
26217  * Different nodes in the AST have different members (i.e. children). This
26218  * method recursively visits children using provided visitor.
26219  *
26220  * \param v Concrete visitor that will be used to recursively visit children
26221  *
26222  * \sa Ast::visit_children for example.
26223  */
26224  void visit_children(visitor::Visitor &v) override;
26225 
26226  /**
26227  * \brief accept (or visit) the current AST node using provided visitor
26228  *
26229  * Instead of visiting children of AST node, like Ast::visit_children,
26230  * accept allows to visit the current node itself using provided concrete
26231  * visitor.
26232  *
26233  * \param v Concrete visitor that will be used to recursively visit node
26234  *
26235  * \sa Ast::accept for example.
26236  */
26237  void accept(visitor::Visitor &v) override;
26238 
26239  /// \}
26240 
26241 private:
26242  /**
26243  * \brief Set this object as parent for all the children
26244  *
26245  * This should be called in every object (with children) constructor
26246  * to set parents. Since it is called only in the constructors it
26247  * should not be virtual to avoid ambiguities (issue #295).
26248  */
26249  void set_parent_in_children();
26250 };
26251 
26252 /** @} */ // end of ast_class
26253 
26254 } // namespace ast
26255 } // namespace nmodl
26256 #endif // !NMODL_AST_LAG_STATEMENT_HPP
26257 #ifndef NMODL_AST_QUEUE_STATEMENT_HPP
26258 #define NMODL_AST_QUEUE_STATEMENT_HPP
26259 
26260 namespace nmodl {
26261 namespace ast {
26262 
26263 /**
26264  * @addtogroup ast_class
26265  * @ingroup ast
26266  * @{
26267  */
26268 
26269 /**
26270  * \brief Represent queue statement in NMODL
26271  *
26272  *
26273  */
26274 class QueueStatement : public Statement {
26275 private:
26276  /// queue type (put/get)
26277  std::shared_ptr<QueueExpressionType> qtype;
26278  /// Name of the variable
26279  std::shared_ptr<Identifier> name;
26280  /// token with location information
26281  std::shared_ptr<ModToken> token;
26282 
26283 public:
26284  /// \name Ctor & dtor
26285  /// \{
26286 
26287  explicit QueueStatement(QueueExpressionType *qtype, Identifier *name);
26288  explicit QueueStatement(const std::shared_ptr<QueueExpressionType> &qtype,
26289  const std::shared_ptr<Identifier> &name);
26290  QueueStatement(const QueueStatement &obj);
26291 
26292  virtual ~QueueStatement() = default;
26293 
26294  /// \}
26295 
26296  /**
26297  * \brief Check if the ast node is an instance of ast::QueueStatement
26298  * \return true as object is of type ast::QueueStatement
26299  */
26300  bool is_queue_statement() const noexcept override { return true; }
26301 
26302  /**
26303  * \brief Return a copy of the current node
26304  *
26305  * Recursively make a new copy/clone of the current node including
26306  * all members and return a pointer to the node. This is used for
26307  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26308  * ast.
26309  *
26310  * @return pointer to the clone/copy of the current node
26311  */
26312  QueueStatement *clone() const override { return new QueueStatement(*this); }
26313 
26314  /// \name Getters
26315  /// \{
26316 
26317  /**
26318  * \brief Return type (ast::AstNodeType) of ast node
26319  *
26320  * Every node in the ast has a type defined in ast::AstNodeType and this
26321  * function is used to retrieve the same.
26322  *
26323  * \return ast node type i.e. ast::AstNodeType::QUEUE_STATEMENT
26324  *
26325  * \sa Ast::get_node_type_name
26326  */
26327  AstNodeType get_node_type() const noexcept override {
26329  }
26330 
26331  /**
26332  * \brief Return type (ast::AstNodeType) of ast node as std::string
26333  *
26334  * Every node in the ast has a type defined in ast::AstNodeType.
26335  * This type name can be returned as a std::string for printing
26336  * node to text/json form.
26337  *
26338  * \return name of the node type as a string i.e. "QueueStatement"
26339  *
26340  * \sa Ast::get_node_name
26341  */
26342  std::string get_node_type_name() const noexcept override {
26343  return "QueueStatement";
26344  }
26345 
26346  /**
26347  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26348  */
26349  std::shared_ptr<Ast> get_shared_ptr() override {
26350  return std::static_pointer_cast<QueueStatement>(shared_from_this());
26351  }
26352 
26353  /**
26354  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26355  */
26356  std::shared_ptr<const Ast> get_shared_ptr() const override {
26357  return std::static_pointer_cast<const QueueStatement>(shared_from_this());
26358  }
26359 
26360  /**
26361  * \brief Return associated token for the current ast node
26362  *
26363  * Not all ast nodes have token information. For example,
26364  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
26365  * solution of ODEs. In this case, we return nullptr to store in the
26366  * nmodl::symtab::SymbolTable.
26367  *
26368  * \return pointer to token if exist otherwise nullptr
26369  */
26370  const ModToken *get_token() const noexcept override { return token.get(); }
26371 
26372  /**
26373  * \brief Getter for member variable \ref QueueStatement.qtype
26374  */
26375  const std::shared_ptr<QueueExpressionType> &get_qtype() const noexcept {
26376  return qtype;
26377  }
26378 
26379  /**
26380  * \brief Getter for member variable \ref QueueStatement.name
26381  */
26382  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
26383 
26384  /// \}
26385 
26386  /// \name Setters
26387  /// \{
26388 
26389  /**
26390  * \brief Set token for the current ast node
26391  */
26392  void set_token(const ModToken &tok) {
26393  token = std::make_shared<ModToken>(tok);
26394  }
26395 
26396  /**
26397  * \brief Setter for member variable \ref QueueStatement.qtype (rvalue
26398  * reference)
26399  */
26400  void set_qtype(std::shared_ptr<QueueExpressionType> &&qtype);
26401 
26402  /**
26403  * \brief Setter for member variable \ref QueueStatement.qtype
26404  */
26405  void set_qtype(const std::shared_ptr<QueueExpressionType> &qtype);
26406 
26407  /**
26408  * \brief Setter for member variable \ref QueueStatement.name (rvalue
26409  * reference)
26410  */
26411  void set_name(std::shared_ptr<Identifier> &&name);
26412 
26413  /**
26414  * \brief Setter for member variable \ref QueueStatement.name
26415  */
26416  void set_name(const std::shared_ptr<Identifier> &name);
26417 
26418  /// \}
26419 
26420  /// \name Visitor
26421  /// \{
26422 
26423  /**
26424  * \brief visit children i.e. member variables of current node using provided
26425  * visitor
26426  *
26427  * Different nodes in the AST have different members (i.e. children). This
26428  * method recursively visits children using provided visitor.
26429  *
26430  * \param v Concrete visitor that will be used to recursively visit children
26431  *
26432  * \sa Ast::visit_children for example.
26433  */
26434  void visit_children(visitor::Visitor &v) override;
26435 
26436  /**
26437  * \brief accept (or visit) the current AST node using provided visitor
26438  *
26439  * Instead of visiting children of AST node, like Ast::visit_children,
26440  * accept allows to visit the current node itself using provided concrete
26441  * visitor.
26442  *
26443  * \param v Concrete visitor that will be used to recursively visit node
26444  *
26445  * \sa Ast::accept for example.
26446  */
26447  void accept(visitor::Visitor &v) override;
26448 
26449  /// \}
26450 
26451 private:
26452  /**
26453  * \brief Set this object as parent for all the children
26454  *
26455  * This should be called in every object (with children) constructor
26456  * to set parents. Since it is called only in the constructors it
26457  * should not be virtual to avoid ambiguities (issue #295).
26458  */
26459  void set_parent_in_children();
26460 };
26461 
26462 /** @} */ // end of ast_class
26463 
26464 } // namespace ast
26465 } // namespace nmodl
26466 #endif // !NMODL_AST_QUEUE_STATEMENT_HPP
26467 #ifndef NMODL_AST_CONSTANT_STATEMENT_HPP
26468 #define NMODL_AST_CONSTANT_STATEMENT_HPP
26469 
26470 namespace nmodl {
26471 namespace ast {
26472 
26473 /**
26474  * @addtogroup ast_class
26475  * @ingroup ast
26476  * @{
26477  */
26478 
26479 /**
26480  * \brief Represent statement in CONSTANT block of NMODL
26481  *
26482  * \todo As ConstantStatement wraps a single ConstantVar,
26483  * this or ast::ConstantVar can be redundant in the future.
26484  *
26485  */
26487 private:
26488  /// single constant variable
26489  std::shared_ptr<ConstantVar> constant;
26490  /// token with location information
26491  std::shared_ptr<ModToken> token;
26492 
26493 public:
26494  /// \name Ctor & dtor
26495  /// \{
26496 
26497  explicit ConstantStatement(ConstantVar *constant);
26498  explicit ConstantStatement(const std::shared_ptr<ConstantVar> &constant);
26500 
26501  virtual ~ConstantStatement() = default;
26502 
26503  /// \}
26504 
26505  /**
26506  * \brief Check if the ast node is an instance of ast::ConstantStatement
26507  * \return true as object is of type ast::ConstantStatement
26508  */
26509  bool is_constant_statement() const noexcept override { return true; }
26510 
26511  /**
26512  * \brief Return a copy of the current node
26513  *
26514  * Recursively make a new copy/clone of the current node including
26515  * all members and return a pointer to the node. This is used for
26516  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26517  * ast.
26518  *
26519  * @return pointer to the clone/copy of the current node
26520  */
26521  ConstantStatement *clone() const override {
26522  return new ConstantStatement(*this);
26523  }
26524 
26525  /// \name Getters
26526  /// \{
26527 
26528  /**
26529  * \brief Return type (ast::AstNodeType) of ast node
26530  *
26531  * Every node in the ast has a type defined in ast::AstNodeType and this
26532  * function is used to retrieve the same.
26533  *
26534  * \return ast node type i.e. ast::AstNodeType::CONSTANT_STATEMENT
26535  *
26536  * \sa Ast::get_node_type_name
26537  */
26538  AstNodeType get_node_type() const noexcept override {
26540  }
26541 
26542  /**
26543  * \brief Return type (ast::AstNodeType) of ast node as std::string
26544  *
26545  * Every node in the ast has a type defined in ast::AstNodeType.
26546  * This type name can be returned as a std::string for printing
26547  * node to text/json form.
26548  *
26549  * \return name of the node type as a string i.e. "ConstantStatement"
26550  *
26551  * \sa Ast::get_node_name
26552  */
26553  std::string get_node_type_name() const noexcept override {
26554  return "ConstantStatement";
26555  }
26556 
26557  /**
26558  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26559  */
26560  std::shared_ptr<Ast> get_shared_ptr() override {
26561  return std::static_pointer_cast<ConstantStatement>(shared_from_this());
26562  }
26563 
26564  /**
26565  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26566  */
26567  std::shared_ptr<const Ast> get_shared_ptr() const override {
26568  return std::static_pointer_cast<const ConstantStatement>(
26569  shared_from_this());
26570  }
26571 
26572  /**
26573  * \brief Return associated token for the current ast node
26574  *
26575  * Not all ast nodes have token information. For example,
26576  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
26577  * solution of ODEs. In this case, we return nullptr to store in the
26578  * nmodl::symtab::SymbolTable.
26579  *
26580  * \return pointer to token if exist otherwise nullptr
26581  */
26582  const ModToken *get_token() const noexcept override { return token.get(); }
26583 
26584  /**
26585  * \brief Getter for member variable \ref ConstantStatement.constant
26586  */
26587  const std::shared_ptr<ConstantVar> &get_constant() const noexcept {
26588  return constant;
26589  }
26590 
26591  /// \}
26592 
26593  /// \name Setters
26594  /// \{
26595 
26596  /**
26597  * \brief Set token for the current ast node
26598  */
26599  void set_token(const ModToken &tok) {
26600  token = std::make_shared<ModToken>(tok);
26601  }
26602 
26603  /**
26604  * \brief Setter for member variable \ref ConstantStatement.constant (rvalue
26605  * reference)
26606  */
26607  void set_constant(std::shared_ptr<ConstantVar> &&constant);
26608 
26609  /**
26610  * \brief Setter for member variable \ref ConstantStatement.constant
26611  */
26612  void set_constant(const std::shared_ptr<ConstantVar> &constant);
26613 
26614  /// \}
26615 
26616  /// \name Visitor
26617  /// \{
26618 
26619  /**
26620  * \brief visit children i.e. member variables of current node using provided
26621  * visitor
26622  *
26623  * Different nodes in the AST have different members (i.e. children). This
26624  * method recursively visits children using provided visitor.
26625  *
26626  * \param v Concrete visitor that will be used to recursively visit children
26627  *
26628  * \sa Ast::visit_children for example.
26629  */
26630  void visit_children(visitor::Visitor &v) override;
26631 
26632  /**
26633  * \brief accept (or visit) the current AST node using provided visitor
26634  *
26635  * Instead of visiting children of AST node, like Ast::visit_children,
26636  * accept allows to visit the current node itself using provided concrete
26637  * visitor.
26638  *
26639  * \param v Concrete visitor that will be used to recursively visit node
26640  *
26641  * \sa Ast::accept for example.
26642  */
26643  void accept(visitor::Visitor &v) override;
26644 
26645  /// \}
26646 
26647 private:
26648  /**
26649  * \brief Set this object as parent for all the children
26650  *
26651  * This should be called in every object (with children) constructor
26652  * to set parents. Since it is called only in the constructors it
26653  * should not be virtual to avoid ambiguities (issue #295).
26654  */
26655  void set_parent_in_children();
26656 };
26657 
26658 /** @} */ // end of ast_class
26659 
26660 } // namespace ast
26661 } // namespace nmodl
26662 #endif // !NMODL_AST_CONSTANT_STATEMENT_HPP
26663 #ifndef NMODL_AST_TABLE_STATEMENT_HPP
26664 #define NMODL_AST_TABLE_STATEMENT_HPP
26665 
26666 namespace nmodl {
26667 namespace ast {
26668 
26669 /**
26670  * @addtogroup ast_class
26671  * @ingroup ast
26672  * @{
26673  */
26674 
26675 /**
26676  * \brief Represents TABLE statement in NMODL
26677  *
26678  *
26679  */
26680 class TableStatement : public Statement {
26681 private:
26682  /// Variables in the table
26684  /// dependent variables
26686  /// from value
26687  std::shared_ptr<Expression> from;
26688  /// to values
26689  std::shared_ptr<Expression> to;
26690  /// an increment factor
26691  std::shared_ptr<Integer> with;
26692  /// token with location information
26693  std::shared_ptr<ModToken> token;
26694 
26695 public:
26696  /// \name Ctor & dtor
26697  /// \{
26698 
26699  explicit TableStatement(NameVector table_vars, NameVector depend_vars,
26700  Expression *from, Expression *to, Integer *with);
26701  explicit TableStatement(const NameVector &table_vars,
26702  const NameVector &depend_vars,
26703  const std::shared_ptr<Expression> &from,
26704  const std::shared_ptr<Expression> &to,
26705  const std::shared_ptr<Integer> &with);
26706  TableStatement(const TableStatement &obj);
26707 
26708  virtual ~TableStatement() = default;
26709 
26710  /// \}
26711 
26712  /**
26713  * \brief Check if the ast node is an instance of ast::TableStatement
26714  * \return true as object is of type ast::TableStatement
26715  */
26716  bool is_table_statement() const noexcept override { return true; }
26717 
26718  /**
26719  * \brief Return a copy of the current node
26720  *
26721  * Recursively make a new copy/clone of the current node including
26722  * all members and return a pointer to the node. This is used for
26723  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26724  * ast.
26725  *
26726  * @return pointer to the clone/copy of the current node
26727  */
26728  TableStatement *clone() const override { return new TableStatement(*this); }
26729 
26730  /// \name Getters
26731  /// \{
26732 
26733  /**
26734  * \brief Return type (ast::AstNodeType) of ast node
26735  *
26736  * Every node in the ast has a type defined in ast::AstNodeType and this
26737  * function is used to retrieve the same.
26738  *
26739  * \return ast node type i.e. ast::AstNodeType::TABLE_STATEMENT
26740  *
26741  * \sa Ast::get_node_type_name
26742  */
26743  AstNodeType get_node_type() const noexcept override {
26745  }
26746 
26747  /**
26748  * \brief Return type (ast::AstNodeType) of ast node as std::string
26749  *
26750  * Every node in the ast has a type defined in ast::AstNodeType.
26751  * This type name can be returned as a std::string for printing
26752  * node to text/json form.
26753  *
26754  * \return name of the node type as a string i.e. "TableStatement"
26755  *
26756  * \sa Ast::get_node_name
26757  */
26758  std::string get_node_type_name() const noexcept override {
26759  return "TableStatement";
26760  }
26761 
26762  /**
26763  * \brief Return NMODL statement of ast node as std::string
26764  *
26765  * Every node is related to a special statement in the NMODL. This
26766  * statement can be returned as a std::string for printing to
26767  * text/json form.
26768  *
26769  * \return name of the statement as a string i.e. "TABLE "
26770  *
26771  * \sa Ast::get_nmodl_name
26772  */
26773  std::string get_nmodl_name() const noexcept override { return "TABLE "; }
26774 
26775  /**
26776  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26777  */
26778  std::shared_ptr<Ast> get_shared_ptr() override {
26779  return std::static_pointer_cast<TableStatement>(shared_from_this());
26780  }
26781 
26782  /**
26783  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26784  */
26785  std::shared_ptr<const Ast> get_shared_ptr() const override {
26786  return std::static_pointer_cast<const TableStatement>(shared_from_this());
26787  }
26788 
26789  /**
26790  * \brief Return associated token for the current ast node
26791  *
26792  * Not all ast nodes have token information. For example,
26793  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
26794  * solution of ODEs. In this case, we return nullptr to store in the
26795  * nmodl::symtab::SymbolTable.
26796  *
26797  * \return pointer to token if exist otherwise nullptr
26798  */
26799  const ModToken *get_token() const noexcept override { return token.get(); }
26800 
26801  /**
26802  * \brief Getter for member variable \ref TableStatement.table_vars
26803  */
26804  const NameVector &get_table_vars() const noexcept { return table_vars; }
26805 
26806  /**
26807  * \brief Getter for member variable \ref TableStatement.depend_vars
26808  */
26809  const NameVector &get_depend_vars() const noexcept { return depend_vars; }
26810 
26811  /**
26812  * \brief Getter for member variable \ref TableStatement.from
26813  */
26814  const std::shared_ptr<Expression> &get_from() const noexcept { return from; }
26815 
26816  /**
26817  * \brief Getter for member variable \ref TableStatement.to
26818  */
26819  const std::shared_ptr<Expression> &get_to() const noexcept { return to; }
26820 
26821  /**
26822  * \brief Getter for member variable \ref TableStatement.with
26823  */
26824  const std::shared_ptr<Integer> &get_with() const noexcept { return with; }
26825 
26826  /// \}
26827 
26828  /// \name Setters
26829  /// \{
26830 
26831  /**
26832  * \brief Set token for the current ast node
26833  */
26834  void set_token(const ModToken &tok) {
26835  token = std::make_shared<ModToken>(tok);
26836  }
26837 
26838  /**
26839  * \brief Setter for member variable \ref TableStatement.table_vars (rvalue
26840  * reference)
26841  */
26842  void set_table_vars(NameVector &&table_vars);
26843 
26844  /**
26845  * \brief Setter for member variable \ref TableStatement.table_vars
26846  */
26847  void set_table_vars(const NameVector &table_vars);
26848 
26849  /**
26850  * \brief Setter for member variable \ref TableStatement.depend_vars (rvalue
26851  * reference)
26852  */
26853  void set_depend_vars(NameVector &&depend_vars);
26854 
26855  /**
26856  * \brief Setter for member variable \ref TableStatement.depend_vars
26857  */
26858  void set_depend_vars(const NameVector &depend_vars);
26859 
26860  /**
26861  * \brief Setter for member variable \ref TableStatement.from (rvalue
26862  * reference)
26863  */
26864  void set_from(std::shared_ptr<Expression> &&from);
26865 
26866  /**
26867  * \brief Setter for member variable \ref TableStatement.from
26868  */
26869  void set_from(const std::shared_ptr<Expression> &from);
26870 
26871  /**
26872  * \brief Setter for member variable \ref TableStatement.to (rvalue reference)
26873  */
26874  void set_to(std::shared_ptr<Expression> &&to);
26875 
26876  /**
26877  * \brief Setter for member variable \ref TableStatement.to
26878  */
26879  void set_to(const std::shared_ptr<Expression> &to);
26880 
26881  /**
26882  * \brief Setter for member variable \ref TableStatement.with (rvalue
26883  * reference)
26884  */
26885  void set_with(std::shared_ptr<Integer> &&with);
26886 
26887  /**
26888  * \brief Setter for member variable \ref TableStatement.with
26889  */
26890  void set_with(const std::shared_ptr<Integer> &with);
26891 
26892  /// \}
26893 
26894  /// \name Visitor
26895  /// \{
26896 
26897  /**
26898  * \brief visit children i.e. member variables of current node using provided
26899  * visitor
26900  *
26901  * Different nodes in the AST have different members (i.e. children). This
26902  * method recursively visits children using provided visitor.
26903  *
26904  * \param v Concrete visitor that will be used to recursively visit children
26905  *
26906  * \sa Ast::visit_children for example.
26907  */
26908  void visit_children(visitor::Visitor &v) override;
26909 
26910  /**
26911  * \brief accept (or visit) the current AST node using provided visitor
26912  *
26913  * Instead of visiting children of AST node, like Ast::visit_children,
26914  * accept allows to visit the current node itself using provided concrete
26915  * visitor.
26916  *
26917  * \param v Concrete visitor that will be used to recursively visit node
26918  *
26919  * \sa Ast::accept for example.
26920  */
26921  void accept(visitor::Visitor &v) override;
26922 
26923  /// \}
26924 
26925 private:
26926  /**
26927  * \brief Set this object as parent for all the children
26928  *
26929  * This should be called in every object (with children) constructor
26930  * to set parents. Since it is called only in the constructors it
26931  * should not be virtual to avoid ambiguities (issue #295).
26932  */
26933  void set_parent_in_children();
26934 };
26935 
26936 /** @} */ // end of ast_class
26937 
26938 } // namespace ast
26939 } // namespace nmodl
26940 #endif // !NMODL_AST_TABLE_STATEMENT_HPP
26941 #ifndef NMODL_AST_SUFFIX_HPP
26942 #define NMODL_AST_SUFFIX_HPP
26943 
26944 namespace nmodl {
26945 namespace ast {
26946 
26947 /**
26948  * @addtogroup ast_class
26949  * @ingroup ast
26950  * @{
26951  */
26952 
26953 /**
26954  * \brief Represents SUFFIX statement in NMODL
26955  *
26956  *
26957  */
26958 class Suffix : public Statement {
26959 private:
26960  /// type of channel
26961  std::shared_ptr<Name> type;
26962  /// Name of the channel
26963  std::shared_ptr<Name> name;
26964  /// token with location information
26965  std::shared_ptr<ModToken> token;
26966 
26967 public:
26968  /// \name Ctor & dtor
26969  /// \{
26970 
26971  explicit Suffix(Name *type, Name *name);
26972  explicit Suffix(const std::shared_ptr<Name> &type,
26973  const std::shared_ptr<Name> &name);
26974  Suffix(const Suffix &obj);
26975 
26976  virtual ~Suffix() = default;
26977 
26978  /// \}
26979 
26980  /**
26981  * \brief Check if the ast node is an instance of ast::Suffix
26982  * \return true as object is of type ast::Suffix
26983  */
26984  bool is_suffix() const noexcept override { return true; }
26985 
26986  /**
26987  * \brief Return a copy of the current node
26988  *
26989  * Recursively make a new copy/clone of the current node including
26990  * all members and return a pointer to the node. This is used for
26991  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26992  * ast.
26993  *
26994  * @return pointer to the clone/copy of the current node
26995  */
26996  Suffix *clone() const override { return new Suffix(*this); }
26997 
26998  /// \name Getters
26999  /// \{
27000 
27001  /**
27002  * \brief Return type (ast::AstNodeType) of ast node
27003  *
27004  * Every node in the ast has a type defined in ast::AstNodeType and this
27005  * function is used to retrieve the same.
27006  *
27007  * \return ast node type i.e. ast::AstNodeType::SUFFIX
27008  *
27009  * \sa Ast::get_node_type_name
27010  */
27011  AstNodeType get_node_type() const noexcept override {
27012  return AstNodeType::SUFFIX;
27013  }
27014 
27015  /**
27016  * \brief Return type (ast::AstNodeType) of ast node as std::string
27017  *
27018  * Every node in the ast has a type defined in ast::AstNodeType.
27019  * This type name can be returned as a std::string for printing
27020  * node to text/json form.
27021  *
27022  * \return name of the node type as a string i.e. "Suffix"
27023  *
27024  * \sa Ast::get_node_name
27025  */
27026  std::string get_node_type_name() const noexcept override { return "Suffix"; }
27027 
27028  /**
27029  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27030  */
27031  std::shared_ptr<Ast> get_shared_ptr() override {
27032  return std::static_pointer_cast<Suffix>(shared_from_this());
27033  }
27034 
27035  /**
27036  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27037  */
27038  std::shared_ptr<const Ast> get_shared_ptr() const override {
27039  return std::static_pointer_cast<const Suffix>(shared_from_this());
27040  }
27041 
27042  /**
27043  * \brief Return associated token for the current ast node
27044  *
27045  * Not all ast nodes have token information. For example,
27046  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
27047  * solution of ODEs. In this case, we return nullptr to store in the
27048  * nmodl::symtab::SymbolTable.
27049  *
27050  * \return pointer to token if exist otherwise nullptr
27051  */
27052  const ModToken *get_token() const noexcept override { return token.get(); }
27053 
27054  /**
27055  * \brief Getter for member variable \ref Suffix.type
27056  */
27057  const std::shared_ptr<Name> &get_type() const noexcept { return type; }
27058 
27059  /**
27060  * \brief Return name of the node
27061  *
27062  * Some ast nodes have a member marked designated as node name. For example,
27063  * in case of this ast::Name has name designated as a
27064  * node name.
27065  *
27066  * @return name of the node as std::string
27067  *
27068  * \sa Ast::get_node_type_name
27069  */
27070  std::string get_node_name() const override;
27071 
27072  /**
27073  * \brief Getter for member variable \ref Suffix.name
27074  */
27075  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
27076 
27077  /// \}
27078 
27079  /// \name Setters
27080  /// \{
27081 
27082  /**
27083  * \brief Set token for the current ast node
27084  */
27085  void set_token(const ModToken &tok) {
27086  token = std::make_shared<ModToken>(tok);
27087  }
27088 
27089  /**
27090  * \brief Setter for member variable \ref Suffix.type (rvalue reference)
27091  */
27092  void set_type(std::shared_ptr<Name> &&type);
27093 
27094  /**
27095  * \brief Setter for member variable \ref Suffix.type
27096  */
27097  void set_type(const std::shared_ptr<Name> &type);
27098 
27099  /**
27100  * \brief Setter for member variable \ref Suffix.name (rvalue reference)
27101  */
27102  void set_name(std::shared_ptr<Name> &&name);
27103 
27104  /**
27105  * \brief Setter for member variable \ref Suffix.name
27106  */
27107  void set_name(const std::shared_ptr<Name> &name);
27108 
27109  /// \}
27110 
27111  /// \name Visitor
27112  /// \{
27113 
27114  /**
27115  * \brief visit children i.e. member variables of current node using provided
27116  * visitor
27117  *
27118  * Different nodes in the AST have different members (i.e. children). This
27119  * method recursively visits children using provided visitor.
27120  *
27121  * \param v Concrete visitor that will be used to recursively visit children
27122  *
27123  * \sa Ast::visit_children for example.
27124  */
27125  void visit_children(visitor::Visitor &v) override;
27126 
27127  /**
27128  * \brief accept (or visit) the current AST node using provided visitor
27129  *
27130  * Instead of visiting children of AST node, like Ast::visit_children,
27131  * accept allows to visit the current node itself using provided concrete
27132  * visitor.
27133  *
27134  * \param v Concrete visitor that will be used to recursively visit node
27135  *
27136  * \sa Ast::accept for example.
27137  */
27138  void accept(visitor::Visitor &v) override;
27139 
27140  /// \}
27141 
27142 private:
27143  /**
27144  * \brief Set this object as parent for all the children
27145  *
27146  * This should be called in every object (with children) constructor
27147  * to set parents. Since it is called only in the constructors it
27148  * should not be virtual to avoid ambiguities (issue #295).
27149  */
27150  void set_parent_in_children();
27151 };
27152 
27153 /** @} */ // end of ast_class
27154 
27155 } // namespace ast
27156 } // namespace nmodl
27157 #endif // !NMODL_AST_SUFFIX_HPP
27158 #ifndef NMODL_AST_USEION_HPP
27159 #define NMODL_AST_USEION_HPP
27160 
27161 namespace nmodl {
27162 namespace ast {
27163 
27164 /**
27165  * @addtogroup ast_class
27166  * @ingroup ast
27167  * @{
27168  */
27169 
27170 /**
27171  * \brief Represents USEION statement in NMODL
27172  *
27173  *
27174  */
27175 class Useion : public Statement {
27176 private:
27177  /// Name of ion
27178  std::shared_ptr<Name> name;
27179  /// Variables being read
27181  /// Variables being written
27183  /// (TODO)
27184  std::shared_ptr<Valence> valence;
27185  /// Ontology to indicate the chemical ion
27186  std::shared_ptr<String> ontology_id;
27187  /// token with location information
27188  std::shared_ptr<ModToken> token;
27189 
27190 public:
27191  /// \name Ctor & dtor
27192  /// \{
27193 
27194  explicit Useion(Name *name, ReadIonVarVector readlist,
27195  WriteIonVarVector writelist, Valence *valence,
27196  String *ontology_id);
27197  explicit Useion(const std::shared_ptr<Name> &name,
27198  const ReadIonVarVector &readlist,
27199  const WriteIonVarVector &writelist,
27200  const std::shared_ptr<Valence> &valence,
27201  const std::shared_ptr<String> &ontology_id);
27202  Useion(const Useion &obj);
27203 
27204  virtual ~Useion() = default;
27205 
27206  /// \}
27207 
27208  /**
27209  * \brief Check if the ast node is an instance of ast::Useion
27210  * \return true as object is of type ast::Useion
27211  */
27212  bool is_useion() const noexcept override { return true; }
27213 
27214  /**
27215  * \brief Return a copy of the current node
27216  *
27217  * Recursively make a new copy/clone of the current node including
27218  * all members and return a pointer to the node. This is used for
27219  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27220  * ast.
27221  *
27222  * @return pointer to the clone/copy of the current node
27223  */
27224  Useion *clone() const override { return new Useion(*this); }
27225 
27226  /// \name Getters
27227  /// \{
27228 
27229  /**
27230  * \brief Return type (ast::AstNodeType) of ast node
27231  *
27232  * Every node in the ast has a type defined in ast::AstNodeType and this
27233  * function is used to retrieve the same.
27234  *
27235  * \return ast node type i.e. ast::AstNodeType::USEION
27236  *
27237  * \sa Ast::get_node_type_name
27238  */
27239  AstNodeType get_node_type() const noexcept override {
27240  return AstNodeType::USEION;
27241  }
27242 
27243  /**
27244  * \brief Return type (ast::AstNodeType) of ast node as std::string
27245  *
27246  * Every node in the ast has a type defined in ast::AstNodeType.
27247  * This type name can be returned as a std::string for printing
27248  * node to text/json form.
27249  *
27250  * \return name of the node type as a string i.e. "Useion"
27251  *
27252  * \sa Ast::get_node_name
27253  */
27254  std::string get_node_type_name() const noexcept override { return "Useion"; }
27255 
27256  /**
27257  * \brief Return NMODL statement of ast node as std::string
27258  *
27259  * Every node is related to a special statement in the NMODL. This
27260  * statement can be returned as a std::string for printing to
27261  * text/json form.
27262  *
27263  * \return name of the statement as a string i.e. "USEION "
27264  *
27265  * \sa Ast::get_nmodl_name
27266  */
27267  std::string get_nmodl_name() const noexcept override { return "USEION "; }
27268 
27269  /**
27270  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27271  */
27272  std::shared_ptr<Ast> get_shared_ptr() override {
27273  return std::static_pointer_cast<Useion>(shared_from_this());
27274  }
27275 
27276  /**
27277  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27278  */
27279  std::shared_ptr<const Ast> get_shared_ptr() const override {
27280  return std::static_pointer_cast<const Useion>(shared_from_this());
27281  }
27282 
27283  /**
27284  * \brief Return associated token for the current ast node
27285  *
27286  * Not all ast nodes have token information. For example,
27287  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
27288  * solution of ODEs. In this case, we return nullptr to store in the
27289  * nmodl::symtab::SymbolTable.
27290  *
27291  * \return pointer to token if exist otherwise nullptr
27292  */
27293  const ModToken *get_token() const noexcept override { return token.get(); }
27294 
27295  /**
27296  * \brief Return name of the node
27297  *
27298  * Some ast nodes have a member marked designated as node name. For example,
27299  * in case of this ast::Name has name designated as a
27300  * node name.
27301  *
27302  * @return name of the node as std::string
27303  *
27304  * \sa Ast::get_node_type_name
27305  */
27306  std::string get_node_name() const override;
27307 
27308  /**
27309  * \brief Getter for member variable \ref Useion.name
27310  */
27311  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
27312 
27313  /**
27314  * \brief Getter for member variable \ref Useion.readlist
27315  */
27316  const ReadIonVarVector &get_readlist() const noexcept { return readlist; }
27317 
27318  /**
27319  * \brief Getter for member variable \ref Useion.writelist
27320  */
27321  const WriteIonVarVector &get_writelist() const noexcept { return writelist; }
27322 
27323  /**
27324  * \brief Getter for member variable \ref Useion.valence
27325  */
27326  const std::shared_ptr<Valence> &get_valence() const noexcept {
27327  return valence;
27328  }
27329 
27330  /**
27331  * \brief Getter for member variable \ref Useion.ontology_id
27332  */
27333  const std::shared_ptr<String> &get_ontology_id() const noexcept {
27334  return ontology_id;
27335  }
27336 
27337  /// \}
27338 
27339  /// \name Setters
27340  /// \{
27341 
27342  /**
27343  * \brief Set token for the current ast node
27344  */
27345  void set_token(const ModToken &tok) {
27346  token = std::make_shared<ModToken>(tok);
27347  }
27348 
27349  /**
27350  * \brief Setter for member variable \ref Useion.name (rvalue reference)
27351  */
27352  void set_name(std::shared_ptr<Name> &&name);
27353 
27354  /**
27355  * \brief Setter for member variable \ref Useion.name
27356  */
27357  void set_name(const std::shared_ptr<Name> &name);
27358 
27359  /**
27360  * \brief Setter for member variable \ref Useion.readlist (rvalue reference)
27361  */
27362  void set_readlist(ReadIonVarVector &&readlist);
27363 
27364  /**
27365  * \brief Setter for member variable \ref Useion.readlist
27366  */
27367  void set_readlist(const ReadIonVarVector &readlist);
27368 
27369  /**
27370  * \brief Setter for member variable \ref Useion.writelist (rvalue reference)
27371  */
27372  void set_writelist(WriteIonVarVector &&writelist);
27373 
27374  /**
27375  * \brief Setter for member variable \ref Useion.writelist
27376  */
27377  void set_writelist(const WriteIonVarVector &writelist);
27378 
27379  /**
27380  * \brief Setter for member variable \ref Useion.valence (rvalue reference)
27381  */
27382  void set_valence(std::shared_ptr<Valence> &&valence);
27383 
27384  /**
27385  * \brief Setter for member variable \ref Useion.valence
27386  */
27387  void set_valence(const std::shared_ptr<Valence> &valence);
27388 
27389  /**
27390  * \brief Setter for member variable \ref Useion.ontology_id (rvalue
27391  * reference)
27392  */
27393  void set_ontology_id(std::shared_ptr<String> &&ontology_id);
27394 
27395  /**
27396  * \brief Setter for member variable \ref Useion.ontology_id
27397  */
27398  void set_ontology_id(const std::shared_ptr<String> &ontology_id);
27399 
27400  /// \}
27401 
27402  /// \name Visitor
27403  /// \{
27404 
27405  /**
27406  * \brief visit children i.e. member variables of current node using provided
27407  * visitor
27408  *
27409  * Different nodes in the AST have different members (i.e. children). This
27410  * method recursively visits children using provided visitor.
27411  *
27412  * \param v Concrete visitor that will be used to recursively visit children
27413  *
27414  * \sa Ast::visit_children for example.
27415  */
27416  void visit_children(visitor::Visitor &v) override;
27417 
27418  /**
27419  * \brief accept (or visit) the current AST node using provided visitor
27420  *
27421  * Instead of visiting children of AST node, like Ast::visit_children,
27422  * accept allows to visit the current node itself using provided concrete
27423  * visitor.
27424  *
27425  * \param v Concrete visitor that will be used to recursively visit node
27426  *
27427  * \sa Ast::accept for example.
27428  */
27429  void accept(visitor::Visitor &v) override;
27430 
27431  /// \}
27432 
27433 private:
27434  /**
27435  * \brief Set this object as parent for all the children
27436  *
27437  * This should be called in every object (with children) constructor
27438  * to set parents. Since it is called only in the constructors it
27439  * should not be virtual to avoid ambiguities (issue #295).
27440  */
27441  void set_parent_in_children();
27442 };
27443 
27444 /** @} */ // end of ast_class
27445 
27446 } // namespace ast
27447 } // namespace nmodl
27448 #endif // !NMODL_AST_USEION_HPP
27449 #ifndef NMODL_AST_NONSPECIFIC_HPP
27450 #define NMODL_AST_NONSPECIFIC_HPP
27451 
27452 namespace nmodl {
27453 namespace ast {
27454 
27455 /**
27456  * @addtogroup ast_class
27457  * @ingroup ast
27458  * @{
27459  */
27460 
27461 /**
27462  * \brief Represents NONSPECIFIC_CURRENT variables statement in NMODL
27463  *
27464  *
27465  */
27466 class Nonspecific : public Statement {
27467 private:
27468  /// Vector of non specific variables
27470  /// token with location information
27471  std::shared_ptr<ModToken> token;
27472 
27473 public:
27474  /// \name Ctor & dtor
27475  /// \{
27476 
27477  explicit Nonspecific(NonspecificCurVarVector currents);
27478  Nonspecific(const Nonspecific &obj);
27479 
27480  virtual ~Nonspecific() = default;
27481 
27482  /// \}
27483 
27484  /**
27485  * \brief Check if the ast node is an instance of ast::Nonspecific
27486  * \return true as object is of type ast::Nonspecific
27487  */
27488  bool is_nonspecific() const noexcept override { return true; }
27489 
27490  /**
27491  * \brief Return a copy of the current node
27492  *
27493  * Recursively make a new copy/clone of the current node including
27494  * all members and return a pointer to the node. This is used for
27495  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27496  * ast.
27497  *
27498  * @return pointer to the clone/copy of the current node
27499  */
27500  Nonspecific *clone() const override { return new Nonspecific(*this); }
27501 
27502  /// \name Getters
27503  /// \{
27504 
27505  /**
27506  * \brief Return type (ast::AstNodeType) of ast node
27507  *
27508  * Every node in the ast has a type defined in ast::AstNodeType and this
27509  * function is used to retrieve the same.
27510  *
27511  * \return ast node type i.e. ast::AstNodeType::NONSPECIFIC
27512  *
27513  * \sa Ast::get_node_type_name
27514  */
27515  AstNodeType get_node_type() const noexcept override {
27516  return AstNodeType::NONSPECIFIC;
27517  }
27518 
27519  /**
27520  * \brief Return type (ast::AstNodeType) of ast node as std::string
27521  *
27522  * Every node in the ast has a type defined in ast::AstNodeType.
27523  * This type name can be returned as a std::string for printing
27524  * node to text/json form.
27525  *
27526  * \return name of the node type as a string i.e. "Nonspecific"
27527  *
27528  * \sa Ast::get_node_name
27529  */
27530  std::string get_node_type_name() const noexcept override {
27531  return "Nonspecific";
27532  }
27533 
27534  /**
27535  * \brief Return NMODL statement of ast node as std::string
27536  *
27537  * Every node is related to a special statement in the NMODL. This
27538  * statement can be returned as a std::string for printing to
27539  * text/json form.
27540  *
27541  * \return name of the statement as a string i.e. "NONSPECIFIC_CURRENT "
27542  *
27543  * \sa Ast::get_nmodl_name
27544  */
27545  std::string get_nmodl_name() const noexcept override {
27546  return "NONSPECIFIC_CURRENT ";
27547  }
27548 
27549  /**
27550  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27551  */
27552  std::shared_ptr<Ast> get_shared_ptr() override {
27553  return std::static_pointer_cast<Nonspecific>(shared_from_this());
27554  }
27555 
27556  /**
27557  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27558  */
27559  std::shared_ptr<const Ast> get_shared_ptr() const override {
27560  return std::static_pointer_cast<const Nonspecific>(shared_from_this());
27561  }
27562 
27563  /**
27564  * \brief Return associated token for the current ast node
27565  *
27566  * Not all ast nodes have token information. For example,
27567  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
27568  * solution of ODEs. In this case, we return nullptr to store in the
27569  * nmodl::symtab::SymbolTable.
27570  *
27571  * \return pointer to token if exist otherwise nullptr
27572  */
27573  const ModToken *get_token() const noexcept override { return token.get(); }
27574 
27575  /**
27576  * \brief Getter for member variable \ref Nonspecific.currents
27577  */
27578  const NonspecificCurVarVector &get_currents() const noexcept {
27579  return currents;
27580  }
27581 
27582  /// \}
27583 
27584  /// \name Setters
27585  /// \{
27586 
27587  /**
27588  * \brief Set token for the current ast node
27589  */
27590  void set_token(const ModToken &tok) {
27591  token = std::make_shared<ModToken>(tok);
27592  }
27593 
27594  /**
27595  * \brief Setter for member variable \ref Nonspecific.currents (rvalue
27596  * reference)
27597  */
27598  void set_currents(NonspecificCurVarVector &&currents);
27599 
27600  /**
27601  * \brief Setter for member variable \ref Nonspecific.currents
27602  */
27603  void set_currents(const NonspecificCurVarVector &currents);
27604 
27605  /// \}
27606 
27607  /// \name Visitor
27608  /// \{
27609 
27610  /**
27611  * \brief visit children i.e. member variables of current node using provided
27612  * visitor
27613  *
27614  * Different nodes in the AST have different members (i.e. children). This
27615  * method recursively visits children using provided visitor.
27616  *
27617  * \param v Concrete visitor that will be used to recursively visit children
27618  *
27619  * \sa Ast::visit_children for example.
27620  */
27621  void visit_children(visitor::Visitor &v) override;
27622 
27623  /**
27624  * \brief accept (or visit) the current AST node using provided visitor
27625  *
27626  * Instead of visiting children of AST node, like Ast::visit_children,
27627  * accept allows to visit the current node itself using provided concrete
27628  * visitor.
27629  *
27630  * \param v Concrete visitor that will be used to recursively visit node
27631  *
27632  * \sa Ast::accept for example.
27633  */
27634  void accept(visitor::Visitor &v) override;
27635 
27636  /// \}
27637 
27638 private:
27639  /**
27640  * \brief Set this object as parent for all the children
27641  *
27642  * This should be called in every object (with children) constructor
27643  * to set parents. Since it is called only in the constructors it
27644  * should not be virtual to avoid ambiguities (issue #295).
27645  */
27646  void set_parent_in_children();
27647 };
27648 
27649 /** @} */ // end of ast_class
27650 
27651 } // namespace ast
27652 } // namespace nmodl
27653 #endif // !NMODL_AST_NONSPECIFIC_HPP
27654 #ifndef NMODL_AST_ELCTRODE_CURRENT_HPP
27655 #define NMODL_AST_ELCTRODE_CURRENT_HPP
27656 
27657 namespace nmodl {
27658 namespace ast {
27659 
27660 /**
27661  * @addtogroup ast_class
27662  * @ingroup ast
27663  * @{
27664  */
27665 
27666 /**
27667  * \brief Represents ELECTRODE_CURRENT variables statement in NMODL
27668  *
27669  *
27670  */
27671 class ElctrodeCurrent : public Statement {
27672 private:
27673  /// Vector of electrode current variables
27675  /// token with location information
27676  std::shared_ptr<ModToken> token;
27677 
27678 public:
27679  /// \name Ctor & dtor
27680  /// \{
27681 
27682  explicit ElctrodeCurrent(ElectrodeCurVarVector currents);
27683  ElctrodeCurrent(const ElctrodeCurrent &obj);
27684 
27685  virtual ~ElctrodeCurrent() = default;
27686 
27687  /// \}
27688 
27689  /**
27690  * \brief Check if the ast node is an instance of ast::ElctrodeCurrent
27691  * \return true as object is of type ast::ElctrodeCurrent
27692  */
27693  bool is_elctrode_current() const noexcept override { return true; }
27694 
27695  /**
27696  * \brief Return a copy of the current node
27697  *
27698  * Recursively make a new copy/clone of the current node including
27699  * all members and return a pointer to the node. This is used for
27700  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27701  * ast.
27702  *
27703  * @return pointer to the clone/copy of the current node
27704  */
27705  ElctrodeCurrent *clone() const override { return new ElctrodeCurrent(*this); }
27706 
27707  /// \name Getters
27708  /// \{
27709 
27710  /**
27711  * \brief Return type (ast::AstNodeType) of ast node
27712  *
27713  * Every node in the ast has a type defined in ast::AstNodeType and this
27714  * function is used to retrieve the same.
27715  *
27716  * \return ast node type i.e. ast::AstNodeType::ELCTRODE_CURRENT
27717  *
27718  * \sa Ast::get_node_type_name
27719  */
27720  AstNodeType get_node_type() const noexcept override {
27722  }
27723 
27724  /**
27725  * \brief Return type (ast::AstNodeType) of ast node as std::string
27726  *
27727  * Every node in the ast has a type defined in ast::AstNodeType.
27728  * This type name can be returned as a std::string for printing
27729  * node to text/json form.
27730  *
27731  * \return name of the node type as a string i.e. "ElctrodeCurrent"
27732  *
27733  * \sa Ast::get_node_name
27734  */
27735  std::string get_node_type_name() const noexcept override {
27736  return "ElctrodeCurrent";
27737  }
27738 
27739  /**
27740  * \brief Return NMODL statement of ast node as std::string
27741  *
27742  * Every node is related to a special statement in the NMODL. This
27743  * statement can be returned as a std::string for printing to
27744  * text/json form.
27745  *
27746  * \return name of the statement as a string i.e. "ELECTRODE_CURRENT "
27747  *
27748  * \sa Ast::get_nmodl_name
27749  */
27750  std::string get_nmodl_name() const noexcept override {
27751  return "ELECTRODE_CURRENT ";
27752  }
27753 
27754  /**
27755  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27756  */
27757  std::shared_ptr<Ast> get_shared_ptr() override {
27758  return std::static_pointer_cast<ElctrodeCurrent>(shared_from_this());
27759  }
27760 
27761  /**
27762  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27763  */
27764  std::shared_ptr<const Ast> get_shared_ptr() const override {
27765  return std::static_pointer_cast<const ElctrodeCurrent>(shared_from_this());
27766  }
27767 
27768  /**
27769  * \brief Return associated token for the current ast node
27770  *
27771  * Not all ast nodes have token information. For example,
27772  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
27773  * solution of ODEs. In this case, we return nullptr to store in the
27774  * nmodl::symtab::SymbolTable.
27775  *
27776  * \return pointer to token if exist otherwise nullptr
27777  */
27778  const ModToken *get_token() const noexcept override { return token.get(); }
27779 
27780  /**
27781  * \brief Getter for member variable \ref ElctrodeCurrent.currents
27782  */
27783  const ElectrodeCurVarVector &get_currents() const noexcept {
27784  return currents;
27785  }
27786 
27787  /// \}
27788 
27789  /// \name Setters
27790  /// \{
27791 
27792  /**
27793  * \brief Set token for the current ast node
27794  */
27795  void set_token(const ModToken &tok) {
27796  token = std::make_shared<ModToken>(tok);
27797  }
27798 
27799  /**
27800  * \brief Setter for member variable \ref ElctrodeCurrent.currents (rvalue
27801  * reference)
27802  */
27803  void set_currents(ElectrodeCurVarVector &&currents);
27804 
27805  /**
27806  * \brief Setter for member variable \ref ElctrodeCurrent.currents
27807  */
27808  void set_currents(const ElectrodeCurVarVector &currents);
27809 
27810  /// \}
27811 
27812  /// \name Visitor
27813  /// \{
27814 
27815  /**
27816  * \brief visit children i.e. member variables of current node using provided
27817  * visitor
27818  *
27819  * Different nodes in the AST have different members (i.e. children). This
27820  * method recursively visits children using provided visitor.
27821  *
27822  * \param v Concrete visitor that will be used to recursively visit children
27823  *
27824  * \sa Ast::visit_children for example.
27825  */
27826  void visit_children(visitor::Visitor &v) override;
27827 
27828  /**
27829  * \brief accept (or visit) the current AST node using provided visitor
27830  *
27831  * Instead of visiting children of AST node, like Ast::visit_children,
27832  * accept allows to visit the current node itself using provided concrete
27833  * visitor.
27834  *
27835  * \param v Concrete visitor that will be used to recursively visit node
27836  *
27837  * \sa Ast::accept for example.
27838  */
27839  void accept(visitor::Visitor &v) override;
27840 
27841  /// \}
27842 
27843 private:
27844  /**
27845  * \brief Set this object as parent for all the children
27846  *
27847  * This should be called in every object (with children) constructor
27848  * to set parents. Since it is called only in the constructors it
27849  * should not be virtual to avoid ambiguities (issue #295).
27850  */
27851  void set_parent_in_children();
27852 };
27853 
27854 /** @} */ // end of ast_class
27855 
27856 } // namespace ast
27857 } // namespace nmodl
27858 #endif // !NMODL_AST_ELCTRODE_CURRENT_HPP
27859 #ifndef NMODL_AST_SECTION_HPP
27860 #define NMODL_AST_SECTION_HPP
27861 
27862 namespace nmodl {
27863 namespace ast {
27864 
27865 /**
27866  * @addtogroup ast_class
27867  * @ingroup ast
27868  * @{
27869  */
27870 
27871 /**
27872  * \brief Represents SECTION variables statement in NMODL
27873  *
27874  *
27875  */
27876 class Section : public Statement {
27877 private:
27878  /// Vector of section variables
27880  /// token with location information
27881  std::shared_ptr<ModToken> token;
27882 
27883 public:
27884  /// \name Ctor & dtor
27885  /// \{
27886 
27887  explicit Section(SectionVarVector sections);
27888  Section(const Section &obj);
27889 
27890  virtual ~Section() = default;
27891 
27892  /// \}
27893 
27894  /**
27895  * \brief Check if the ast node is an instance of ast::Section
27896  * \return true as object is of type ast::Section
27897  */
27898  bool is_section() const noexcept override { return true; }
27899 
27900  /**
27901  * \brief Return a copy of the current node
27902  *
27903  * Recursively make a new copy/clone of the current node including
27904  * all members and return a pointer to the node. This is used for
27905  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27906  * ast.
27907  *
27908  * @return pointer to the clone/copy of the current node
27909  */
27910  Section *clone() const override { return new Section(*this); }
27911 
27912  /// \name Getters
27913  /// \{
27914 
27915  /**
27916  * \brief Return type (ast::AstNodeType) of ast node
27917  *
27918  * Every node in the ast has a type defined in ast::AstNodeType and this
27919  * function is used to retrieve the same.
27920  *
27921  * \return ast node type i.e. ast::AstNodeType::SECTION
27922  *
27923  * \sa Ast::get_node_type_name
27924  */
27925  AstNodeType get_node_type() const noexcept override {
27926  return AstNodeType::SECTION;
27927  }
27928 
27929  /**
27930  * \brief Return type (ast::AstNodeType) of ast node as std::string
27931  *
27932  * Every node in the ast has a type defined in ast::AstNodeType.
27933  * This type name can be returned as a std::string for printing
27934  * node to text/json form.
27935  *
27936  * \return name of the node type as a string i.e. "Section"
27937  *
27938  * \sa Ast::get_node_name
27939  */
27940  std::string get_node_type_name() const noexcept override { return "Section"; }
27941 
27942  /**
27943  * \brief Return NMODL statement of ast node as std::string
27944  *
27945  * Every node is related to a special statement in the NMODL. This
27946  * statement can be returned as a std::string for printing to
27947  * text/json form.
27948  *
27949  * \return name of the statement as a string i.e. "SECTION "
27950  *
27951  * \sa Ast::get_nmodl_name
27952  */
27953  std::string get_nmodl_name() const noexcept override { return "SECTION "; }
27954 
27955  /**
27956  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27957  */
27958  std::shared_ptr<Ast> get_shared_ptr() override {
27959  return std::static_pointer_cast<Section>(shared_from_this());
27960  }
27961 
27962  /**
27963  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27964  */
27965  std::shared_ptr<const Ast> get_shared_ptr() const override {
27966  return std::static_pointer_cast<const Section>(shared_from_this());
27967  }
27968 
27969  /**
27970  * \brief Return associated token for the current ast node
27971  *
27972  * Not all ast nodes have token information. For example,
27973  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
27974  * solution of ODEs. In this case, we return nullptr to store in the
27975  * nmodl::symtab::SymbolTable.
27976  *
27977  * \return pointer to token if exist otherwise nullptr
27978  */
27979  const ModToken *get_token() const noexcept override { return token.get(); }
27980 
27981  /**
27982  * \brief Getter for member variable \ref Section.sections
27983  */
27984  const SectionVarVector &get_sections() const noexcept { return sections; }
27985 
27986  /// \}
27987 
27988  /// \name Setters
27989  /// \{
27990 
27991  /**
27992  * \brief Set token for the current ast node
27993  */
27994  void set_token(const ModToken &tok) {
27995  token = std::make_shared<ModToken>(tok);
27996  }
27997 
27998  /**
27999  * \brief Setter for member variable \ref Section.sections (rvalue reference)
28000  */
28001  void set_sections(SectionVarVector &&sections);
28002 
28003  /**
28004  * \brief Setter for member variable \ref Section.sections
28005  */
28006  void set_sections(const SectionVarVector &sections);
28007 
28008  /// \}
28009 
28010  /// \name Visitor
28011  /// \{
28012 
28013  /**
28014  * \brief visit children i.e. member variables of current node using provided
28015  * visitor
28016  *
28017  * Different nodes in the AST have different members (i.e. children). This
28018  * method recursively visits children using provided visitor.
28019  *
28020  * \param v Concrete visitor that will be used to recursively visit children
28021  *
28022  * \sa Ast::visit_children for example.
28023  */
28024  void visit_children(visitor::Visitor &v) override;
28025 
28026  /**
28027  * \brief accept (or visit) the current AST node using provided visitor
28028  *
28029  * Instead of visiting children of AST node, like Ast::visit_children,
28030  * accept allows to visit the current node itself using provided concrete
28031  * visitor.
28032  *
28033  * \param v Concrete visitor that will be used to recursively visit node
28034  *
28035  * \sa Ast::accept for example.
28036  */
28037  void accept(visitor::Visitor &v) override;
28038 
28039  /// \}
28040 
28041 private:
28042  /**
28043  * \brief Set this object as parent for all the children
28044  *
28045  * This should be called in every object (with children) constructor
28046  * to set parents. Since it is called only in the constructors it
28047  * should not be virtual to avoid ambiguities (issue #295).
28048  */
28049  void set_parent_in_children();
28050 };
28051 
28052 /** @} */ // end of ast_class
28053 
28054 } // namespace ast
28055 } // namespace nmodl
28056 #endif // !NMODL_AST_SECTION_HPP
28057 #ifndef NMODL_AST_RANGE_HPP
28058 #define NMODL_AST_RANGE_HPP
28059 
28060 namespace nmodl {
28061 namespace ast {
28062 
28063 /**
28064  * @addtogroup ast_class
28065  * @ingroup ast
28066  * @{
28067  */
28068 
28069 /**
28070  * \brief Represents RANGE variables statement in NMODL
28071  *
28072  *
28073  */
28074 class Range : public Statement {
28075 private:
28076  /// Vector of range variables
28078  /// token with location information
28079  std::shared_ptr<ModToken> token;
28080 
28081 public:
28082  /// \name Ctor & dtor
28083  /// \{
28084 
28085  explicit Range(RangeVarVector variables);
28086  Range(const Range &obj);
28087 
28088  virtual ~Range() = default;
28089 
28090  /// \}
28091 
28092  /**
28093  * \brief Check if the ast node is an instance of ast::Range
28094  * \return true as object is of type ast::Range
28095  */
28096  bool is_range() const noexcept override { return true; }
28097 
28098  /**
28099  * \brief Return a copy of the current node
28100  *
28101  * Recursively make a new copy/clone of the current node including
28102  * all members and return a pointer to the node. This is used for
28103  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28104  * ast.
28105  *
28106  * @return pointer to the clone/copy of the current node
28107  */
28108  Range *clone() const override { return new Range(*this); }
28109 
28110  /// \name Getters
28111  /// \{
28112 
28113  /**
28114  * \brief Return type (ast::AstNodeType) of ast node
28115  *
28116  * Every node in the ast has a type defined in ast::AstNodeType and this
28117  * function is used to retrieve the same.
28118  *
28119  * \return ast node type i.e. ast::AstNodeType::RANGE
28120  *
28121  * \sa Ast::get_node_type_name
28122  */
28123  AstNodeType get_node_type() const noexcept override {
28124  return AstNodeType::RANGE;
28125  }
28126 
28127  /**
28128  * \brief Return type (ast::AstNodeType) of ast node as std::string
28129  *
28130  * Every node in the ast has a type defined in ast::AstNodeType.
28131  * This type name can be returned as a std::string for printing
28132  * node to text/json form.
28133  *
28134  * \return name of the node type as a string i.e. "Range"
28135  *
28136  * \sa Ast::get_node_name
28137  */
28138  std::string get_node_type_name() const noexcept override { return "Range"; }
28139 
28140  /**
28141  * \brief Return NMODL statement of ast node as std::string
28142  *
28143  * Every node is related to a special statement in the NMODL. This
28144  * statement can be returned as a std::string for printing to
28145  * text/json form.
28146  *
28147  * \return name of the statement as a string i.e. "RANGE "
28148  *
28149  * \sa Ast::get_nmodl_name
28150  */
28151  std::string get_nmodl_name() const noexcept override { return "RANGE "; }
28152 
28153  /**
28154  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28155  */
28156  std::shared_ptr<Ast> get_shared_ptr() override {
28157  return std::static_pointer_cast<Range>(shared_from_this());
28158  }
28159 
28160  /**
28161  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28162  */
28163  std::shared_ptr<const Ast> get_shared_ptr() const override {
28164  return std::static_pointer_cast<const Range>(shared_from_this());
28165  }
28166 
28167  /**
28168  * \brief Return associated token for the current ast node
28169  *
28170  * Not all ast nodes have token information. For example,
28171  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
28172  * solution of ODEs. In this case, we return nullptr to store in the
28173  * nmodl::symtab::SymbolTable.
28174  *
28175  * \return pointer to token if exist otherwise nullptr
28176  */
28177  const ModToken *get_token() const noexcept override { return token.get(); }
28178 
28179  /**
28180  * \brief Getter for member variable \ref Range.variables
28181  */
28182  const RangeVarVector &get_variables() const noexcept { return variables; }
28183 
28184  /// \}
28185 
28186  /// \name Setters
28187  /// \{
28188 
28189  /**
28190  * \brief Set token for the current ast node
28191  */
28192  void set_token(const ModToken &tok) {
28193  token = std::make_shared<ModToken>(tok);
28194  }
28195 
28196  /**
28197  * \brief Setter for member variable \ref Range.variables (rvalue reference)
28198  */
28199  void set_variables(RangeVarVector &&variables);
28200 
28201  /**
28202  * \brief Setter for member variable \ref Range.variables
28203  */
28204  void set_variables(const RangeVarVector &variables);
28205 
28206  /// \}
28207 
28208  /// \name Visitor
28209  /// \{
28210 
28211  /**
28212  * \brief visit children i.e. member variables of current node using provided
28213  * visitor
28214  *
28215  * Different nodes in the AST have different members (i.e. children). This
28216  * method recursively visits children using provided visitor.
28217  *
28218  * \param v Concrete visitor that will be used to recursively visit children
28219  *
28220  * \sa Ast::visit_children for example.
28221  */
28222  void visit_children(visitor::Visitor &v) override;
28223 
28224  /**
28225  * \brief accept (or visit) the current AST node using provided visitor
28226  *
28227  * Instead of visiting children of AST node, like Ast::visit_children,
28228  * accept allows to visit the current node itself using provided concrete
28229  * visitor.
28230  *
28231  * \param v Concrete visitor that will be used to recursively visit node
28232  *
28233  * \sa Ast::accept for example.
28234  */
28235  void accept(visitor::Visitor &v) override;
28236 
28237  /// \}
28238 
28239 private:
28240  /**
28241  * \brief Set this object as parent for all the children
28242  *
28243  * This should be called in every object (with children) constructor
28244  * to set parents. Since it is called only in the constructors it
28245  * should not be virtual to avoid ambiguities (issue #295).
28246  */
28247  void set_parent_in_children();
28248 };
28249 
28250 /** @} */ // end of ast_class
28251 
28252 } // namespace ast
28253 } // namespace nmodl
28254 #endif // !NMODL_AST_RANGE_HPP
28255 #ifndef NMODL_AST_GLOBAL_HPP
28256 #define NMODL_AST_GLOBAL_HPP
28257 
28258 namespace nmodl {
28259 namespace ast {
28260 
28261 /**
28262  * @addtogroup ast_class
28263  * @ingroup ast
28264  * @{
28265  */
28266 
28267 /**
28268  * \brief Represents GLOBAL statement in NMODL
28269  *
28270  *
28271  */
28272 class Global : public Statement {
28273 private:
28274  /// Vector of global variables
28276  /// token with location information
28277  std::shared_ptr<ModToken> token;
28278 
28279 public:
28280  /// \name Ctor & dtor
28281  /// \{
28282 
28283  explicit Global(GlobalVarVector variables);
28284  Global(const Global &obj);
28285 
28286  virtual ~Global() = default;
28287 
28288  /// \}
28289 
28290  /**
28291  * \brief Check if the ast node is an instance of ast::Global
28292  * \return true as object is of type ast::Global
28293  */
28294  bool is_global() const noexcept override { return true; }
28295 
28296  /**
28297  * \brief Return a copy of the current node
28298  *
28299  * Recursively make a new copy/clone of the current node including
28300  * all members and return a pointer to the node. This is used for
28301  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28302  * ast.
28303  *
28304  * @return pointer to the clone/copy of the current node
28305  */
28306  Global *clone() const override { return new Global(*this); }
28307 
28308  /// \name Getters
28309  /// \{
28310 
28311  /**
28312  * \brief Return type (ast::AstNodeType) of ast node
28313  *
28314  * Every node in the ast has a type defined in ast::AstNodeType and this
28315  * function is used to retrieve the same.
28316  *
28317  * \return ast node type i.e. ast::AstNodeType::GLOBAL
28318  *
28319  * \sa Ast::get_node_type_name
28320  */
28321  AstNodeType get_node_type() const noexcept override {
28322  return AstNodeType::GLOBAL;
28323  }
28324 
28325  /**
28326  * \brief Return type (ast::AstNodeType) of ast node as std::string
28327  *
28328  * Every node in the ast has a type defined in ast::AstNodeType.
28329  * This type name can be returned as a std::string for printing
28330  * node to text/json form.
28331  *
28332  * \return name of the node type as a string i.e. "Global"
28333  *
28334  * \sa Ast::get_node_name
28335  */
28336  std::string get_node_type_name() const noexcept override { return "Global"; }
28337 
28338  /**
28339  * \brief Return NMODL statement of ast node as std::string
28340  *
28341  * Every node is related to a special statement in the NMODL. This
28342  * statement can be returned as a std::string for printing to
28343  * text/json form.
28344  *
28345  * \return name of the statement as a string i.e. "GLOBAL "
28346  *
28347  * \sa Ast::get_nmodl_name
28348  */
28349  std::string get_nmodl_name() const noexcept override { return "GLOBAL "; }
28350 
28351  /**
28352  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28353  */
28354  std::shared_ptr<Ast> get_shared_ptr() override {
28355  return std::static_pointer_cast<Global>(shared_from_this());
28356  }
28357 
28358  /**
28359  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28360  */
28361  std::shared_ptr<const Ast> get_shared_ptr() const override {
28362  return std::static_pointer_cast<const Global>(shared_from_this());
28363  }
28364 
28365  /**
28366  * \brief Return associated token for the current ast node
28367  *
28368  * Not all ast nodes have token information. For example,
28369  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
28370  * solution of ODEs. In this case, we return nullptr to store in the
28371  * nmodl::symtab::SymbolTable.
28372  *
28373  * \return pointer to token if exist otherwise nullptr
28374  */
28375  const ModToken *get_token() const noexcept override { return token.get(); }
28376 
28377  /**
28378  * \brief Add member to variables by raw pointer
28379  */
28381  variables.emplace_back(n);
28382 
28383  // set parents
28384  n->set_parent(this);
28385  }
28386 
28387  /**
28388  * \brief Add member to variables by shared_ptr
28389  */
28390  void emplace_back_global_var(std::shared_ptr<GlobalVar> n) {
28391  variables.emplace_back(n);
28392  // set parents
28393  n->set_parent(this);
28394  }
28395 
28396  /**
28397  * \brief Erase member to variables
28398  */
28399  GlobalVarVector::const_iterator
28400  erase_global_var(GlobalVarVector::const_iterator first) {
28401  auto first_it = const_iter_cast(variables, first);
28402  return variables.erase(first_it);
28403  }
28404  /**
28405  * \brief Erase members to variables
28406  */
28407  GlobalVarVector::const_iterator
28408  erase_global_var(GlobalVarVector::const_iterator first,
28409  GlobalVarVector::const_iterator last) {
28410  auto first_it = const_iter_cast(variables, first);
28411  auto last_it = const_iter_cast(variables, last);
28412  return variables.erase(first_it, last_it);
28413  }
28414  /**
28415  * \brief Erase non-consecutive members to variables
28416  *
28417  * loosely following the cpp reference of remove_if
28418  */
28419  size_t erase_global_var(std::unordered_set<GlobalVar *> &to_be_erased) {
28420  auto first = variables.begin();
28421  auto last = variables.end();
28422  auto result = first;
28423 
28424  while (first != last) {
28425  // automatically erase dangling pointers from the uset while
28426  // looking for them to erase them in the vector
28427  if (to_be_erased.erase(first->get()) == 0) {
28428  reset_global_var(result, *first);
28429  ++result;
28430  }
28431  ++first;
28432  }
28433 
28434  size_t out = last - result;
28435  erase_global_var(result, last);
28436 
28437  return out;
28438  }
28439 
28440  /**
28441  * \brief Insert member to variables
28442  */
28443  GlobalVarVector::const_iterator
28444  insert_global_var(GlobalVarVector::const_iterator position,
28445  const std::shared_ptr<GlobalVar> &n) {
28446  n->set_parent(this);
28447  auto pos_it = const_iter_cast(variables, position);
28448  return variables.insert(pos_it, n);
28449  }
28450  /**
28451  * \brief Insert members to variables
28452  */
28453  template <class NodeType, class InputIterator>
28454  void insert_global_var(GlobalVarVector::const_iterator position, NodeType &to,
28455  InputIterator first, InputIterator last) {
28456 
28457  for (auto it = first; it != last; ++it) {
28458  auto &n = *it;
28459  // set parents
28460  n->set_parent(this);
28461  }
28462  auto pos_it = const_iter_cast(variables, position);
28463  auto first_it = const_iter_cast(to, first);
28464  auto last_it = const_iter_cast(to, last);
28465  variables.insert(pos_it, first_it, last_it);
28466  }
28467 
28468  /**
28469  * \brief Reset member to variables
28470  */
28471  void reset_global_var(GlobalVarVector::const_iterator position,
28472  GlobalVar *n) {
28473  // set parents
28474  n->set_parent(this);
28475 
28476  variables[position - variables.begin()].reset(n);
28477  }
28478 
28479  /**
28480  * \brief Reset member to variables
28481  */
28482  void reset_global_var(GlobalVarVector::const_iterator position,
28483  std::shared_ptr<GlobalVar> n) {
28484  // set parents
28485  n->set_parent(this);
28486 
28487  variables[position - variables.begin()] = n;
28488  }
28489 
28490  /**
28491  * \brief Getter for member variable \ref Global.variables
28492  */
28493  const GlobalVarVector &get_variables() const noexcept { return variables; }
28494 
28495  /// \}
28496 
28497  /// \name Setters
28498  /// \{
28499 
28500  /**
28501  * \brief Set token for the current ast node
28502  */
28503  void set_token(const ModToken &tok) {
28504  token = std::make_shared<ModToken>(tok);
28505  }
28506 
28507  /**
28508  * \brief Setter for member variable \ref Global.variables (rvalue reference)
28509  */
28510  void set_variables(GlobalVarVector &&variables);
28511 
28512  /**
28513  * \brief Setter for member variable \ref Global.variables
28514  */
28515  void set_variables(const GlobalVarVector &variables);
28516 
28517  /// \}
28518 
28519  /// \name Visitor
28520  /// \{
28521 
28522  /**
28523  * \brief visit children i.e. member variables of current node using provided
28524  * visitor
28525  *
28526  * Different nodes in the AST have different members (i.e. children). This
28527  * method recursively visits children using provided visitor.
28528  *
28529  * \param v Concrete visitor that will be used to recursively visit children
28530  *
28531  * \sa Ast::visit_children for example.
28532  */
28533  void visit_children(visitor::Visitor &v) override;
28534 
28535  /**
28536  * \brief accept (or visit) the current AST node using provided visitor
28537  *
28538  * Instead of visiting children of AST node, like Ast::visit_children,
28539  * accept allows to visit the current node itself using provided concrete
28540  * visitor.
28541  *
28542  * \param v Concrete visitor that will be used to recursively visit node
28543  *
28544  * \sa Ast::accept for example.
28545  */
28546  void accept(visitor::Visitor &v) override;
28547 
28548  /// \}
28549 
28550 private:
28551  /**
28552  * \brief Set this object as parent for all the children
28553  *
28554  * This should be called in every object (with children) constructor
28555  * to set parents. Since it is called only in the constructors it
28556  * should not be virtual to avoid ambiguities (issue #295).
28557  */
28558  void set_parent_in_children();
28559 };
28560 
28561 /** @} */ // end of ast_class
28562 
28563 } // namespace ast
28564 } // namespace nmodl
28565 #endif // !NMODL_AST_GLOBAL_HPP
28566 #ifndef NMODL_AST_POINTER_HPP
28567 #define NMODL_AST_POINTER_HPP
28568 
28569 namespace nmodl {
28570 namespace ast {
28571 
28572 /**
28573  * @addtogroup ast_class
28574  * @ingroup ast
28575  * @{
28576  */
28577 
28578 /**
28579  * \brief Represents POINTER statement in NMODL
28580  *
28581  *
28582  */
28583 class Pointer : public Statement {
28584 private:
28585  /// Vector of pointer variables
28587  /// token with location information
28588  std::shared_ptr<ModToken> token;
28589 
28590 public:
28591  /// \name Ctor & dtor
28592  /// \{
28593 
28594  explicit Pointer(PointerVarVector variables);
28595  Pointer(const Pointer &obj);
28596 
28597  virtual ~Pointer() = default;
28598 
28599  /// \}
28600 
28601  /**
28602  * \brief Check if the ast node is an instance of ast::Pointer
28603  * \return true as object is of type ast::Pointer
28604  */
28605  bool is_pointer() const noexcept override { return true; }
28606 
28607  /**
28608  * \brief Return a copy of the current node
28609  *
28610  * Recursively make a new copy/clone of the current node including
28611  * all members and return a pointer to the node. This is used for
28612  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28613  * ast.
28614  *
28615  * @return pointer to the clone/copy of the current node
28616  */
28617  Pointer *clone() const override { return new Pointer(*this); }
28618 
28619  /// \name Getters
28620  /// \{
28621 
28622  /**
28623  * \brief Return type (ast::AstNodeType) of ast node
28624  *
28625  * Every node in the ast has a type defined in ast::AstNodeType and this
28626  * function is used to retrieve the same.
28627  *
28628  * \return ast node type i.e. ast::AstNodeType::POINTER
28629  *
28630  * \sa Ast::get_node_type_name
28631  */
28632  AstNodeType get_node_type() const noexcept override {
28633  return AstNodeType::POINTER;
28634  }
28635 
28636  /**
28637  * \brief Return type (ast::AstNodeType) of ast node as std::string
28638  *
28639  * Every node in the ast has a type defined in ast::AstNodeType.
28640  * This type name can be returned as a std::string for printing
28641  * node to text/json form.
28642  *
28643  * \return name of the node type as a string i.e. "Pointer"
28644  *
28645  * \sa Ast::get_node_name
28646  */
28647  std::string get_node_type_name() const noexcept override { return "Pointer"; }
28648 
28649  /**
28650  * \brief Return NMODL statement of ast node as std::string
28651  *
28652  * Every node is related to a special statement in the NMODL. This
28653  * statement can be returned as a std::string for printing to
28654  * text/json form.
28655  *
28656  * \return name of the statement as a string i.e. "POINTER "
28657  *
28658  * \sa Ast::get_nmodl_name
28659  */
28660  std::string get_nmodl_name() const noexcept override { return "POINTER "; }
28661 
28662  /**
28663  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28664  */
28665  std::shared_ptr<Ast> get_shared_ptr() override {
28666  return std::static_pointer_cast<Pointer>(shared_from_this());
28667  }
28668 
28669  /**
28670  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28671  */
28672  std::shared_ptr<const Ast> get_shared_ptr() const override {
28673  return std::static_pointer_cast<const Pointer>(shared_from_this());
28674  }
28675 
28676  /**
28677  * \brief Return associated token for the current ast node
28678  *
28679  * Not all ast nodes have token information. For example,
28680  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
28681  * solution of ODEs. In this case, we return nullptr to store in the
28682  * nmodl::symtab::SymbolTable.
28683  *
28684  * \return pointer to token if exist otherwise nullptr
28685  */
28686  const ModToken *get_token() const noexcept override { return token.get(); }
28687 
28688  /**
28689  * \brief Getter for member variable \ref Pointer.variables
28690  */
28691  const PointerVarVector &get_variables() const noexcept { return variables; }
28692 
28693  /// \}
28694 
28695  /// \name Setters
28696  /// \{
28697 
28698  /**
28699  * \brief Set token for the current ast node
28700  */
28701  void set_token(const ModToken &tok) {
28702  token = std::make_shared<ModToken>(tok);
28703  }
28704 
28705  /**
28706  * \brief Setter for member variable \ref Pointer.variables (rvalue reference)
28707  */
28708  void set_variables(PointerVarVector &&variables);
28709 
28710  /**
28711  * \brief Setter for member variable \ref Pointer.variables
28712  */
28713  void set_variables(const PointerVarVector &variables);
28714 
28715  /// \}
28716 
28717  /// \name Visitor
28718  /// \{
28719 
28720  /**
28721  * \brief visit children i.e. member variables of current node using provided
28722  * visitor
28723  *
28724  * Different nodes in the AST have different members (i.e. children). This
28725  * method recursively visits children using provided visitor.
28726  *
28727  * \param v Concrete visitor that will be used to recursively visit children
28728  *
28729  * \sa Ast::visit_children for example.
28730  */
28731  void visit_children(visitor::Visitor &v) override;
28732 
28733  /**
28734  * \brief accept (or visit) the current AST node using provided visitor
28735  *
28736  * Instead of visiting children of AST node, like Ast::visit_children,
28737  * accept allows to visit the current node itself using provided concrete
28738  * visitor.
28739  *
28740  * \param v Concrete visitor that will be used to recursively visit node
28741  *
28742  * \sa Ast::accept for example.
28743  */
28744  void accept(visitor::Visitor &v) override;
28745 
28746  /// \}
28747 
28748 private:
28749  /**
28750  * \brief Set this object as parent for all the children
28751  *
28752  * This should be called in every object (with children) constructor
28753  * to set parents. Since it is called only in the constructors it
28754  * should not be virtual to avoid ambiguities (issue #295).
28755  */
28756  void set_parent_in_children();
28757 };
28758 
28759 /** @} */ // end of ast_class
28760 
28761 } // namespace ast
28762 } // namespace nmodl
28763 #endif // !NMODL_AST_POINTER_HPP
28764 #ifndef NMODL_AST_BBCORE_POINTER_HPP
28765 #define NMODL_AST_BBCORE_POINTER_HPP
28766 
28767 namespace nmodl {
28768 namespace ast {
28769 
28770 /**
28771  * @addtogroup ast_class
28772  * @ingroup ast
28773  * @{
28774  */
28775 
28776 /**
28777  * \brief Represents BBCOREPOINTER statement in NMODL
28778  *
28779  * Here is an example of BBCOREPOINTER statement:
28780  *
28781  * \code{.mod}
28782  * NEURON {
28783  * THREADSAFE
28784  * POINT_PROCESS ProbAMPANMDA_EMS
28785  * BBCOREPOINTER rng, data
28786  * \endcode
28787  *
28788  */
28789 class BbcorePointer : public Statement {
28790 private:
28791  /// Vector of bbcore pointer variables
28793  /// token with location information
28794  std::shared_ptr<ModToken> token;
28795 
28796 public:
28797  /// \name Ctor & dtor
28798  /// \{
28799 
28800  explicit BbcorePointer(BbcorePointerVarVector variables);
28801  BbcorePointer(const BbcorePointer &obj);
28802 
28803  virtual ~BbcorePointer() = default;
28804 
28805  /// \}
28806 
28807  /**
28808  * \brief Check if the ast node is an instance of ast::BbcorePointer
28809  * \return true as object is of type ast::BbcorePointer
28810  */
28811  bool is_bbcore_pointer() const noexcept override { return true; }
28812 
28813  /**
28814  * \brief Return a copy of the current node
28815  *
28816  * Recursively make a new copy/clone of the current node including
28817  * all members and return a pointer to the node. This is used for
28818  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28819  * ast.
28820  *
28821  * @return pointer to the clone/copy of the current node
28822  */
28823  BbcorePointer *clone() const override { return new BbcorePointer(*this); }
28824 
28825  /// \name Getters
28826  /// \{
28827 
28828  /**
28829  * \brief Return type (ast::AstNodeType) of ast node
28830  *
28831  * Every node in the ast has a type defined in ast::AstNodeType and this
28832  * function is used to retrieve the same.
28833  *
28834  * \return ast node type i.e. ast::AstNodeType::BBCORE_POINTER
28835  *
28836  * \sa Ast::get_node_type_name
28837  */
28838  AstNodeType get_node_type() const noexcept override {
28840  }
28841 
28842  /**
28843  * \brief Return type (ast::AstNodeType) of ast node as std::string
28844  *
28845  * Every node in the ast has a type defined in ast::AstNodeType.
28846  * This type name can be returned as a std::string for printing
28847  * node to text/json form.
28848  *
28849  * \return name of the node type as a string i.e. "BbcorePointer"
28850  *
28851  * \sa Ast::get_node_name
28852  */
28853  std::string get_node_type_name() const noexcept override {
28854  return "BbcorePointer";
28855  }
28856 
28857  /**
28858  * \brief Return NMODL statement of ast node as std::string
28859  *
28860  * Every node is related to a special statement in the NMODL. This
28861  * statement can be returned as a std::string for printing to
28862  * text/json form.
28863  *
28864  * \return name of the statement as a string i.e. "BBCOREPOINTER "
28865  *
28866  * \sa Ast::get_nmodl_name
28867  */
28868  std::string get_nmodl_name() const noexcept override {
28869  return "BBCOREPOINTER ";
28870  }
28871 
28872  /**
28873  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28874  */
28875  std::shared_ptr<Ast> get_shared_ptr() override {
28876  return std::static_pointer_cast<BbcorePointer>(shared_from_this());
28877  }
28878 
28879  /**
28880  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28881  */
28882  std::shared_ptr<const Ast> get_shared_ptr() const override {
28883  return std::static_pointer_cast<const BbcorePointer>(shared_from_this());
28884  }
28885 
28886  /**
28887  * \brief Return associated token for the current ast node
28888  *
28889  * Not all ast nodes have token information. For example,
28890  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
28891  * solution of ODEs. In this case, we return nullptr to store in the
28892  * nmodl::symtab::SymbolTable.
28893  *
28894  * \return pointer to token if exist otherwise nullptr
28895  */
28896  const ModToken *get_token() const noexcept override { return token.get(); }
28897 
28898  /**
28899  * \brief Getter for member variable \ref BbcorePointer.variables
28900  */
28901  const BbcorePointerVarVector &get_variables() const noexcept {
28902  return variables;
28903  }
28904 
28905  /// \}
28906 
28907  /// \name Setters
28908  /// \{
28909 
28910  /**
28911  * \brief Set token for the current ast node
28912  */
28913  void set_token(const ModToken &tok) {
28914  token = std::make_shared<ModToken>(tok);
28915  }
28916 
28917  /**
28918  * \brief Setter for member variable \ref BbcorePointer.variables (rvalue
28919  * reference)
28920  */
28921  void set_variables(BbcorePointerVarVector &&variables);
28922 
28923  /**
28924  * \brief Setter for member variable \ref BbcorePointer.variables
28925  */
28926  void set_variables(const BbcorePointerVarVector &variables);
28927 
28928  /// \}
28929 
28930  /// \name Visitor
28931  /// \{
28932 
28933  /**
28934  * \brief visit children i.e. member variables of current node using provided
28935  * visitor
28936  *
28937  * Different nodes in the AST have different members (i.e. children). This
28938  * method recursively visits children using provided visitor.
28939  *
28940  * \param v Concrete visitor that will be used to recursively visit children
28941  *
28942  * \sa Ast::visit_children for example.
28943  */
28944  void visit_children(visitor::Visitor &v) override;
28945 
28946  /**
28947  * \brief accept (or visit) the current AST node using provided visitor
28948  *
28949  * Instead of visiting children of AST node, like Ast::visit_children,
28950  * accept allows to visit the current node itself using provided concrete
28951  * visitor.
28952  *
28953  * \param v Concrete visitor that will be used to recursively visit node
28954  *
28955  * \sa Ast::accept for example.
28956  */
28957  void accept(visitor::Visitor &v) override;
28958 
28959  /// \}
28960 
28961 private:
28962  /**
28963  * \brief Set this object as parent for all the children
28964  *
28965  * This should be called in every object (with children) constructor
28966  * to set parents. Since it is called only in the constructors it
28967  * should not be virtual to avoid ambiguities (issue #295).
28968  */
28969  void set_parent_in_children();
28970 };
28971 
28972 /** @} */ // end of ast_class
28973 
28974 } // namespace ast
28975 } // namespace nmodl
28976 #endif // !NMODL_AST_BBCORE_POINTER_HPP
28977 #ifndef NMODL_AST_EXTERNAL_HPP
28978 #define NMODL_AST_EXTERNAL_HPP
28979 
28980 namespace nmodl {
28981 namespace ast {
28982 
28983 /**
28984  * @addtogroup ast_class
28985  * @ingroup ast
28986  * @{
28987  */
28988 
28989 /**
28990  * \brief Represents EXTERNAL statement in NMODL
28991  *
28992  *
28993  */
28994 class External : public Statement {
28995 private:
28996  /// Vector of external variables
28998  /// token with location information
28999  std::shared_ptr<ModToken> token;
29000 
29001 public:
29002  /// \name Ctor & dtor
29003  /// \{
29004 
29005  explicit External(ExternVarVector variables);
29006  External(const External &obj);
29007 
29008  virtual ~External() = default;
29009 
29010  /// \}
29011 
29012  /**
29013  * \brief Check if the ast node is an instance of ast::External
29014  * \return true as object is of type ast::External
29015  */
29016  bool is_external() const noexcept override { return true; }
29017 
29018  /**
29019  * \brief Return a copy of the current node
29020  *
29021  * Recursively make a new copy/clone of the current node including
29022  * all members and return a pointer to the node. This is used for
29023  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29024  * ast.
29025  *
29026  * @return pointer to the clone/copy of the current node
29027  */
29028  External *clone() const override { return new External(*this); }
29029 
29030  /// \name Getters
29031  /// \{
29032 
29033  /**
29034  * \brief Return type (ast::AstNodeType) of ast node
29035  *
29036  * Every node in the ast has a type defined in ast::AstNodeType and this
29037  * function is used to retrieve the same.
29038  *
29039  * \return ast node type i.e. ast::AstNodeType::EXTERNAL
29040  *
29041  * \sa Ast::get_node_type_name
29042  */
29043  AstNodeType get_node_type() const noexcept override {
29044  return AstNodeType::EXTERNAL;
29045  }
29046 
29047  /**
29048  * \brief Return type (ast::AstNodeType) of ast node as std::string
29049  *
29050  * Every node in the ast has a type defined in ast::AstNodeType.
29051  * This type name can be returned as a std::string for printing
29052  * node to text/json form.
29053  *
29054  * \return name of the node type as a string i.e. "External"
29055  *
29056  * \sa Ast::get_node_name
29057  */
29058  std::string get_node_type_name() const noexcept override {
29059  return "External";
29060  }
29061 
29062  /**
29063  * \brief Return NMODL statement of ast node as std::string
29064  *
29065  * Every node is related to a special statement in the NMODL. This
29066  * statement can be returned as a std::string for printing to
29067  * text/json form.
29068  *
29069  * \return name of the statement as a string i.e. "EXTERNAL "
29070  *
29071  * \sa Ast::get_nmodl_name
29072  */
29073  std::string get_nmodl_name() const noexcept override { return "EXTERNAL "; }
29074 
29075  /**
29076  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29077  */
29078  std::shared_ptr<Ast> get_shared_ptr() override {
29079  return std::static_pointer_cast<External>(shared_from_this());
29080  }
29081 
29082  /**
29083  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29084  */
29085  std::shared_ptr<const Ast> get_shared_ptr() const override {
29086  return std::static_pointer_cast<const External>(shared_from_this());
29087  }
29088 
29089  /**
29090  * \brief Return associated token for the current ast node
29091  *
29092  * Not all ast nodes have token information. For example,
29093  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
29094  * solution of ODEs. In this case, we return nullptr to store in the
29095  * nmodl::symtab::SymbolTable.
29096  *
29097  * \return pointer to token if exist otherwise nullptr
29098  */
29099  const ModToken *get_token() const noexcept override { return token.get(); }
29100 
29101  /**
29102  * \brief Getter for member variable \ref External.variables
29103  */
29104  const ExternVarVector &get_variables() const noexcept { return variables; }
29105 
29106  /// \}
29107 
29108  /// \name Setters
29109  /// \{
29110 
29111  /**
29112  * \brief Set token for the current ast node
29113  */
29114  void set_token(const ModToken &tok) {
29115  token = std::make_shared<ModToken>(tok);
29116  }
29117 
29118  /**
29119  * \brief Setter for member variable \ref External.variables (rvalue
29120  * reference)
29121  */
29122  void set_variables(ExternVarVector &&variables);
29123 
29124  /**
29125  * \brief Setter for member variable \ref External.variables
29126  */
29127  void set_variables(const ExternVarVector &variables);
29128 
29129  /// \}
29130 
29131  /// \name Visitor
29132  /// \{
29133 
29134  /**
29135  * \brief visit children i.e. member variables of current node using provided
29136  * visitor
29137  *
29138  * Different nodes in the AST have different members (i.e. children). This
29139  * method recursively visits children using provided visitor.
29140  *
29141  * \param v Concrete visitor that will be used to recursively visit children
29142  *
29143  * \sa Ast::visit_children for example.
29144  */
29145  void visit_children(visitor::Visitor &v) override;
29146 
29147  /**
29148  * \brief accept (or visit) the current AST node using provided visitor
29149  *
29150  * Instead of visiting children of AST node, like Ast::visit_children,
29151  * accept allows to visit the current node itself using provided concrete
29152  * visitor.
29153  *
29154  * \param v Concrete visitor that will be used to recursively visit node
29155  *
29156  * \sa Ast::accept for example.
29157  */
29158  void accept(visitor::Visitor &v) override;
29159 
29160  /// \}
29161 
29162 private:
29163  /**
29164  * \brief Set this object as parent for all the children
29165  *
29166  * This should be called in every object (with children) constructor
29167  * to set parents. Since it is called only in the constructors it
29168  * should not be virtual to avoid ambiguities (issue #295).
29169  */
29170  void set_parent_in_children();
29171 };
29172 
29173 /** @} */ // end of ast_class
29174 
29175 } // namespace ast
29176 } // namespace nmodl
29177 #endif // !NMODL_AST_EXTERNAL_HPP
29178 #ifndef NMODL_AST_THREAD_SAFE_HPP
29179 #define NMODL_AST_THREAD_SAFE_HPP
29180 
29181 namespace nmodl {
29182 namespace ast {
29183 
29184 /**
29185  * @addtogroup ast_class
29186  * @ingroup ast
29187  * @{
29188  */
29189 
29190 /**
29191  * \brief Represents THREADSAFE statement in NMODL
29192  *
29193  *
29194  */
29195 class ThreadSafe : public Statement {
29196 private:
29197  /// Vector of thread safe variables
29199  /// token with location information
29200  std::shared_ptr<ModToken> token;
29201 
29202 public:
29203  /// \name Ctor & dtor
29204  /// \{
29205 
29206  explicit ThreadSafe(ThreadsafeVarVector variables);
29207  ThreadSafe(const ThreadSafe &obj);
29208 
29209  virtual ~ThreadSafe() = default;
29210 
29211  /// \}
29212 
29213  /**
29214  * \brief Check if the ast node is an instance of ast::ThreadSafe
29215  * \return true as object is of type ast::ThreadSafe
29216  */
29217  bool is_thread_safe() const noexcept override { return true; }
29218 
29219  /**
29220  * \brief Return a copy of the current node
29221  *
29222  * Recursively make a new copy/clone of the current node including
29223  * all members and return a pointer to the node. This is used for
29224  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29225  * ast.
29226  *
29227  * @return pointer to the clone/copy of the current node
29228  */
29229  ThreadSafe *clone() const override { return new ThreadSafe(*this); }
29230 
29231  /// \name Getters
29232  /// \{
29233 
29234  /**
29235  * \brief Return type (ast::AstNodeType) of ast node
29236  *
29237  * Every node in the ast has a type defined in ast::AstNodeType and this
29238  * function is used to retrieve the same.
29239  *
29240  * \return ast node type i.e. ast::AstNodeType::THREAD_SAFE
29241  *
29242  * \sa Ast::get_node_type_name
29243  */
29244  AstNodeType get_node_type() const noexcept override {
29245  return AstNodeType::THREAD_SAFE;
29246  }
29247 
29248  /**
29249  * \brief Return type (ast::AstNodeType) of ast node as std::string
29250  *
29251  * Every node in the ast has a type defined in ast::AstNodeType.
29252  * This type name can be returned as a std::string for printing
29253  * node to text/json form.
29254  *
29255  * \return name of the node type as a string i.e. "ThreadSafe"
29256  *
29257  * \sa Ast::get_node_name
29258  */
29259  std::string get_node_type_name() const noexcept override {
29260  return "ThreadSafe";
29261  }
29262 
29263  /**
29264  * \brief Return NMODL statement of ast node as std::string
29265  *
29266  * Every node is related to a special statement in the NMODL. This
29267  * statement can be returned as a std::string for printing to
29268  * text/json form.
29269  *
29270  * \return name of the statement as a string i.e. "THREADSAFE"
29271  *
29272  * \sa Ast::get_nmodl_name
29273  */
29274  std::string get_nmodl_name() const noexcept override { return "THREADSAFE"; }
29275 
29276  /**
29277  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29278  */
29279  std::shared_ptr<Ast> get_shared_ptr() override {
29280  return std::static_pointer_cast<ThreadSafe>(shared_from_this());
29281  }
29282 
29283  /**
29284  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29285  */
29286  std::shared_ptr<const Ast> get_shared_ptr() const override {
29287  return std::static_pointer_cast<const ThreadSafe>(shared_from_this());
29288  }
29289 
29290  /**
29291  * \brief Return associated token for the current ast node
29292  *
29293  * Not all ast nodes have token information. For example,
29294  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
29295  * solution of ODEs. In this case, we return nullptr to store in the
29296  * nmodl::symtab::SymbolTable.
29297  *
29298  * \return pointer to token if exist otherwise nullptr
29299  */
29300  const ModToken *get_token() const noexcept override { return token.get(); }
29301 
29302  /**
29303  * \brief Getter for member variable \ref ThreadSafe.variables
29304  */
29305  const ThreadsafeVarVector &get_variables() const noexcept {
29306  return variables;
29307  }
29308 
29309  /// \}
29310 
29311  /// \name Setters
29312  /// \{
29313 
29314  /**
29315  * \brief Set token for the current ast node
29316  */
29317  void set_token(const ModToken &tok) {
29318  token = std::make_shared<ModToken>(tok);
29319  }
29320 
29321  /**
29322  * \brief Setter for member variable \ref ThreadSafe.variables (rvalue
29323  * reference)
29324  */
29325  void set_variables(ThreadsafeVarVector &&variables);
29326 
29327  /**
29328  * \brief Setter for member variable \ref ThreadSafe.variables
29329  */
29330  void set_variables(const ThreadsafeVarVector &variables);
29331 
29332  /// \}
29333 
29334  /// \name Visitor
29335  /// \{
29336 
29337  /**
29338  * \brief visit children i.e. member variables of current node using provided
29339  * visitor
29340  *
29341  * Different nodes in the AST have different members (i.e. children). This
29342  * method recursively visits children using provided visitor.
29343  *
29344  * \param v Concrete visitor that will be used to recursively visit children
29345  *
29346  * \sa Ast::visit_children for example.
29347  */
29348  void visit_children(visitor::Visitor &v) override;
29349 
29350  /**
29351  * \brief accept (or visit) the current AST node using provided visitor
29352  *
29353  * Instead of visiting children of AST node, like Ast::visit_children,
29354  * accept allows to visit the current node itself using provided concrete
29355  * visitor.
29356  *
29357  * \param v Concrete visitor that will be used to recursively visit node
29358  *
29359  * \sa Ast::accept for example.
29360  */
29361  void accept(visitor::Visitor &v) override;
29362 
29363  /// \}
29364 
29365 private:
29366  /**
29367  * \brief Set this object as parent for all the children
29368  *
29369  * This should be called in every object (with children) constructor
29370  * to set parents. Since it is called only in the constructors it
29371  * should not be virtual to avoid ambiguities (issue #295).
29372  */
29373  void set_parent_in_children();
29374 };
29375 
29376 /** @} */ // end of ast_class
29377 
29378 } // namespace ast
29379 } // namespace nmodl
29380 #endif // !NMODL_AST_THREAD_SAFE_HPP
29381 #ifndef NMODL_AST_VERBATIM_HPP
29382 #define NMODL_AST_VERBATIM_HPP
29383 
29384 namespace nmodl {
29385 namespace ast {
29386 
29387 /**
29388  * @addtogroup ast_class
29389  * @ingroup ast
29390  * @{
29391  */
29392 
29393 /**
29394  * \brief Represents a C code block
29395  *
29396  *
29397  */
29398 class Verbatim : public Statement {
29399 private:
29400  /// C code as a string
29401  std::shared_ptr<String> statement;
29402  /// token with location information
29403  std::shared_ptr<ModToken> token;
29404 
29405 public:
29406  /// \name Ctor & dtor
29407  /// \{
29408 
29409  explicit Verbatim(String *statement);
29410  explicit Verbatim(const std::shared_ptr<String> &statement);
29411  Verbatim(const Verbatim &obj);
29412 
29413  virtual ~Verbatim() = default;
29414 
29415  /// \}
29416 
29417  /**
29418  * \brief Check if the ast node is an instance of ast::Verbatim
29419  * \return true as object is of type ast::Verbatim
29420  */
29421  bool is_verbatim() const noexcept override { return true; }
29422 
29423  /**
29424  * \brief Return a copy of the current node
29425  *
29426  * Recursively make a new copy/clone of the current node including
29427  * all members and return a pointer to the node. This is used for
29428  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29429  * ast.
29430  *
29431  * @return pointer to the clone/copy of the current node
29432  */
29433  Verbatim *clone() const override { return new Verbatim(*this); }
29434 
29435  /// \name Getters
29436  /// \{
29437 
29438  /**
29439  * \brief Return type (ast::AstNodeType) of ast node
29440  *
29441  * Every node in the ast has a type defined in ast::AstNodeType and this
29442  * function is used to retrieve the same.
29443  *
29444  * \return ast node type i.e. ast::AstNodeType::VERBATIM
29445  *
29446  * \sa Ast::get_node_type_name
29447  */
29448  AstNodeType get_node_type() const noexcept override {
29449  return AstNodeType::VERBATIM;
29450  }
29451 
29452  /**
29453  * \brief Return type (ast::AstNodeType) of ast node as std::string
29454  *
29455  * Every node in the ast has a type defined in ast::AstNodeType.
29456  * This type name can be returned as a std::string for printing
29457  * node to text/json form.
29458  *
29459  * \return name of the node type as a string i.e. "Verbatim"
29460  *
29461  * \sa Ast::get_node_name
29462  */
29463  std::string get_node_type_name() const noexcept override {
29464  return "Verbatim";
29465  }
29466 
29467  /**
29468  * \brief Return NMODL statement of ast node as std::string
29469  *
29470  * Every node is related to a special statement in the NMODL. This
29471  * statement can be returned as a std::string for printing to
29472  * text/json form.
29473  *
29474  * \return name of the statement as a string i.e. "VERBATIM"
29475  *
29476  * \sa Ast::get_nmodl_name
29477  */
29478  std::string get_nmodl_name() const noexcept override { return "VERBATIM"; }
29479 
29480  /**
29481  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29482  */
29483  std::shared_ptr<Ast> get_shared_ptr() override {
29484  return std::static_pointer_cast<Verbatim>(shared_from_this());
29485  }
29486 
29487  /**
29488  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29489  */
29490  std::shared_ptr<const Ast> get_shared_ptr() const override {
29491  return std::static_pointer_cast<const Verbatim>(shared_from_this());
29492  }
29493 
29494  /**
29495  * \brief Return associated token for the current ast node
29496  *
29497  * Not all ast nodes have token information. For example,
29498  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
29499  * solution of ODEs. In this case, we return nullptr to store in the
29500  * nmodl::symtab::SymbolTable.
29501  *
29502  * \return pointer to token if exist otherwise nullptr
29503  */
29504  const ModToken *get_token() const noexcept override { return token.get(); }
29505 
29506  /**
29507  * \brief Getter for member variable \ref Verbatim.statement
29508  */
29509  const std::shared_ptr<String> &get_statement() const noexcept {
29510  return statement;
29511  }
29512 
29513  /// \}
29514 
29515  /// \name Setters
29516  /// \{
29517 
29518  /**
29519  * \brief Set token for the current ast node
29520  */
29521  void set_token(const ModToken &tok) {
29522  token = std::make_shared<ModToken>(tok);
29523  }
29524 
29525  /**
29526  * \brief Setter for member variable \ref Verbatim.statement (rvalue
29527  * reference)
29528  */
29529  void set_statement(std::shared_ptr<String> &&statement);
29530 
29531  /**
29532  * \brief Setter for member variable \ref Verbatim.statement
29533  */
29534  void set_statement(const std::shared_ptr<String> &statement);
29535 
29536  /// \}
29537 
29538  /// \name Visitor
29539  /// \{
29540 
29541  /**
29542  * \brief visit children i.e. member variables of current node using provided
29543  * visitor
29544  *
29545  * Different nodes in the AST have different members (i.e. children). This
29546  * method recursively visits children using provided visitor.
29547  *
29548  * \param v Concrete visitor that will be used to recursively visit children
29549  *
29550  * \sa Ast::visit_children for example.
29551  */
29552  void visit_children(visitor::Visitor &v) override;
29553 
29554  /**
29555  * \brief accept (or visit) the current AST node using provided visitor
29556  *
29557  * Instead of visiting children of AST node, like Ast::visit_children,
29558  * accept allows to visit the current node itself using provided concrete
29559  * visitor.
29560  *
29561  * \param v Concrete visitor that will be used to recursively visit node
29562  *
29563  * \sa Ast::accept for example.
29564  */
29565  void accept(visitor::Visitor &v) override;
29566 
29567  /// \}
29568 
29569 private:
29570  /**
29571  * \brief Set this object as parent for all the children
29572  *
29573  * This should be called in every object (with children) constructor
29574  * to set parents. Since it is called only in the constructors it
29575  * should not be virtual to avoid ambiguities (issue #295).
29576  */
29577  void set_parent_in_children();
29578 };
29579 
29580 /** @} */ // end of ast_class
29581 
29582 } // namespace ast
29583 } // namespace nmodl
29584 #endif // !NMODL_AST_VERBATIM_HPP
29585 #ifndef NMODL_AST_LINE_COMMENT_HPP
29586 #define NMODL_AST_LINE_COMMENT_HPP
29587 
29588 namespace nmodl {
29589 namespace ast {
29590 
29591 /**
29592  * @addtogroup ast_class
29593  * @ingroup ast
29594  * @{
29595  */
29596 
29597 /**
29598  * \brief Represents a one line comment in NMODL
29599  *
29600  *
29601  */
29602 class LineComment : public Statement {
29603 private:
29604  /// comment text
29605  std::shared_ptr<String> statement;
29606  /// token with location information
29607  std::shared_ptr<ModToken> token;
29608 
29609 public:
29610  /// \name Ctor & dtor
29611  /// \{
29612 
29613  explicit LineComment(String *statement);
29614  explicit LineComment(const std::shared_ptr<String> &statement);
29615  LineComment(const LineComment &obj);
29616 
29617  virtual ~LineComment() = default;
29618 
29619  /// \}
29620 
29621  /**
29622  * \brief Check if the ast node is an instance of ast::LineComment
29623  * \return true as object is of type ast::LineComment
29624  */
29625  bool is_line_comment() const noexcept override { return true; }
29626 
29627  /**
29628  * \brief Return a copy of the current node
29629  *
29630  * Recursively make a new copy/clone of the current node including
29631  * all members and return a pointer to the node. This is used for
29632  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29633  * ast.
29634  *
29635  * @return pointer to the clone/copy of the current node
29636  */
29637  LineComment *clone() const override { return new LineComment(*this); }
29638 
29639  /// \name Getters
29640  /// \{
29641 
29642  /**
29643  * \brief Return type (ast::AstNodeType) of ast node
29644  *
29645  * Every node in the ast has a type defined in ast::AstNodeType and this
29646  * function is used to retrieve the same.
29647  *
29648  * \return ast node type i.e. ast::AstNodeType::LINE_COMMENT
29649  *
29650  * \sa Ast::get_node_type_name
29651  */
29652  AstNodeType get_node_type() const noexcept override {
29654  }
29655 
29656  /**
29657  * \brief Return type (ast::AstNodeType) of ast node as std::string
29658  *
29659  * Every node in the ast has a type defined in ast::AstNodeType.
29660  * This type name can be returned as a std::string for printing
29661  * node to text/json form.
29662  *
29663  * \return name of the node type as a string i.e. "LineComment"
29664  *
29665  * \sa Ast::get_node_name
29666  */
29667  std::string get_node_type_name() const noexcept override {
29668  return "LineComment";
29669  }
29670 
29671  /**
29672  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29673  */
29674  std::shared_ptr<Ast> get_shared_ptr() override {
29675  return std::static_pointer_cast<LineComment>(shared_from_this());
29676  }
29677 
29678  /**
29679  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29680  */
29681  std::shared_ptr<const Ast> get_shared_ptr() const override {
29682  return std::static_pointer_cast<const LineComment>(shared_from_this());
29683  }
29684 
29685  /**
29686  * \brief Return associated token for the current ast node
29687  *
29688  * Not all ast nodes have token information. For example,
29689  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
29690  * solution of ODEs. In this case, we return nullptr to store in the
29691  * nmodl::symtab::SymbolTable.
29692  *
29693  * \return pointer to token if exist otherwise nullptr
29694  */
29695  const ModToken *get_token() const noexcept override { return token.get(); }
29696 
29697  /**
29698  * \brief Getter for member variable \ref LineComment.statement
29699  */
29700  const std::shared_ptr<String> &get_statement() const noexcept {
29701  return statement;
29702  }
29703 
29704  /// \}
29705 
29706  /// \name Setters
29707  /// \{
29708 
29709  /**
29710  * \brief Set token for the current ast node
29711  */
29712  void set_token(const ModToken &tok) {
29713  token = std::make_shared<ModToken>(tok);
29714  }
29715 
29716  /**
29717  * \brief Setter for member variable \ref LineComment.statement (rvalue
29718  * reference)
29719  */
29720  void set_statement(std::shared_ptr<String> &&statement);
29721 
29722  /**
29723  * \brief Setter for member variable \ref LineComment.statement
29724  */
29725  void set_statement(const std::shared_ptr<String> &statement);
29726 
29727  /// \}
29728 
29729  /// \name Visitor
29730  /// \{
29731 
29732  /**
29733  * \brief visit children i.e. member variables of current node using provided
29734  * visitor
29735  *
29736  * Different nodes in the AST have different members (i.e. children). This
29737  * method recursively visits children using provided visitor.
29738  *
29739  * \param v Concrete visitor that will be used to recursively visit children
29740  *
29741  * \sa Ast::visit_children for example.
29742  */
29743  void visit_children(visitor::Visitor &v) override;
29744 
29745  /**
29746  * \brief accept (or visit) the current AST node using provided visitor
29747  *
29748  * Instead of visiting children of AST node, like Ast::visit_children,
29749  * accept allows to visit the current node itself using provided concrete
29750  * visitor.
29751  *
29752  * \param v Concrete visitor that will be used to recursively visit node
29753  *
29754  * \sa Ast::accept for example.
29755  */
29756  void accept(visitor::Visitor &v) override;
29757 
29758  /// \}
29759 
29760 private:
29761  /**
29762  * \brief Set this object as parent for all the children
29763  *
29764  * This should be called in every object (with children) constructor
29765  * to set parents. Since it is called only in the constructors it
29766  * should not be virtual to avoid ambiguities (issue #295).
29767  */
29768  void set_parent_in_children();
29769 };
29770 
29771 /** @} */ // end of ast_class
29772 
29773 } // namespace ast
29774 } // namespace nmodl
29775 #endif // !NMODL_AST_LINE_COMMENT_HPP
29776 #ifndef NMODL_AST_BLOCK_COMMENT_HPP
29777 #define NMODL_AST_BLOCK_COMMENT_HPP
29778 
29779 namespace nmodl {
29780 namespace ast {
29781 
29782 /**
29783  * @addtogroup ast_class
29784  * @ingroup ast
29785  * @{
29786  */
29787 
29788 /**
29789  * \brief Represents a multi-line comment in NMODL
29790  *
29791  *
29792  */
29793 class BlockComment : public Statement {
29794 private:
29795  /// comment text
29796  std::shared_ptr<String> statement;
29797  /// token with location information
29798  std::shared_ptr<ModToken> token;
29799 
29800 public:
29801  /// \name Ctor & dtor
29802  /// \{
29803 
29804  explicit BlockComment(String *statement);
29805  explicit BlockComment(const std::shared_ptr<String> &statement);
29806  BlockComment(const BlockComment &obj);
29807 
29808  virtual ~BlockComment() = default;
29809 
29810  /// \}
29811 
29812  /**
29813  * \brief Check if the ast node is an instance of ast::BlockComment
29814  * \return true as object is of type ast::BlockComment
29815  */
29816  bool is_block_comment() const noexcept override { return true; }
29817 
29818  /**
29819  * \brief Return a copy of the current node
29820  *
29821  * Recursively make a new copy/clone of the current node including
29822  * all members and return a pointer to the node. This is used for
29823  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29824  * ast.
29825  *
29826  * @return pointer to the clone/copy of the current node
29827  */
29828  BlockComment *clone() const override { return new BlockComment(*this); }
29829 
29830  /// \name Getters
29831  /// \{
29832 
29833  /**
29834  * \brief Return type (ast::AstNodeType) of ast node
29835  *
29836  * Every node in the ast has a type defined in ast::AstNodeType and this
29837  * function is used to retrieve the same.
29838  *
29839  * \return ast node type i.e. ast::AstNodeType::BLOCK_COMMENT
29840  *
29841  * \sa Ast::get_node_type_name
29842  */
29843  AstNodeType get_node_type() const noexcept override {
29845  }
29846 
29847  /**
29848  * \brief Return type (ast::AstNodeType) of ast node as std::string
29849  *
29850  * Every node in the ast has a type defined in ast::AstNodeType.
29851  * This type name can be returned as a std::string for printing
29852  * node to text/json form.
29853  *
29854  * \return name of the node type as a string i.e. "BlockComment"
29855  *
29856  * \sa Ast::get_node_name
29857  */
29858  std::string get_node_type_name() const noexcept override {
29859  return "BlockComment";
29860  }
29861 
29862  /**
29863  * \brief Return NMODL statement of ast node as std::string
29864  *
29865  * Every node is related to a special statement in the NMODL. This
29866  * statement can be returned as a std::string for printing to
29867  * text/json form.
29868  *
29869  * \return name of the statement as a string i.e. "COMMENT"
29870  *
29871  * \sa Ast::get_nmodl_name
29872  */
29873  std::string get_nmodl_name() const noexcept override { return "COMMENT"; }
29874 
29875  /**
29876  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29877  */
29878  std::shared_ptr<Ast> get_shared_ptr() override {
29879  return std::static_pointer_cast<BlockComment>(shared_from_this());
29880  }
29881 
29882  /**
29883  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29884  */
29885  std::shared_ptr<const Ast> get_shared_ptr() const override {
29886  return std::static_pointer_cast<const BlockComment>(shared_from_this());
29887  }
29888 
29889  /**
29890  * \brief Return associated token for the current ast node
29891  *
29892  * Not all ast nodes have token information. For example,
29893  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
29894  * solution of ODEs. In this case, we return nullptr to store in the
29895  * nmodl::symtab::SymbolTable.
29896  *
29897  * \return pointer to token if exist otherwise nullptr
29898  */
29899  const ModToken *get_token() const noexcept override { return token.get(); }
29900 
29901  /**
29902  * \brief Getter for member variable \ref BlockComment.statement
29903  */
29904  const std::shared_ptr<String> &get_statement() const noexcept {
29905  return statement;
29906  }
29907 
29908  /// \}
29909 
29910  /// \name Setters
29911  /// \{
29912 
29913  /**
29914  * \brief Set token for the current ast node
29915  */
29916  void set_token(const ModToken &tok) {
29917  token = std::make_shared<ModToken>(tok);
29918  }
29919 
29920  /**
29921  * \brief Setter for member variable \ref BlockComment.statement (rvalue
29922  * reference)
29923  */
29924  void set_statement(std::shared_ptr<String> &&statement);
29925 
29926  /**
29927  * \brief Setter for member variable \ref BlockComment.statement
29928  */
29929  void set_statement(const std::shared_ptr<String> &statement);
29930 
29931  /// \}
29932 
29933  /// \name Visitor
29934  /// \{
29935 
29936  /**
29937  * \brief visit children i.e. member variables of current node using provided
29938  * visitor
29939  *
29940  * Different nodes in the AST have different members (i.e. children). This
29941  * method recursively visits children using provided visitor.
29942  *
29943  * \param v Concrete visitor that will be used to recursively visit children
29944  *
29945  * \sa Ast::visit_children for example.
29946  */
29947  void visit_children(visitor::Visitor &v) override;
29948 
29949  /**
29950  * \brief accept (or visit) the current AST node using provided visitor
29951  *
29952  * Instead of visiting children of AST node, like Ast::visit_children,
29953  * accept allows to visit the current node itself using provided concrete
29954  * visitor.
29955  *
29956  * \param v Concrete visitor that will be used to recursively visit node
29957  *
29958  * \sa Ast::accept for example.
29959  */
29960  void accept(visitor::Visitor &v) override;
29961 
29962  /// \}
29963 
29964 private:
29965  /**
29966  * \brief Set this object as parent for all the children
29967  *
29968  * This should be called in every object (with children) constructor
29969  * to set parents. Since it is called only in the constructors it
29970  * should not be virtual to avoid ambiguities (issue #295).
29971  */
29972  void set_parent_in_children();
29973 };
29974 
29975 /** @} */ // end of ast_class
29976 
29977 } // namespace ast
29978 } // namespace nmodl
29979 #endif // !NMODL_AST_BLOCK_COMMENT_HPP
29980 #ifndef NMODL_AST_ONTOLOGY_STATEMENT_HPP
29981 #define NMODL_AST_ONTOLOGY_STATEMENT_HPP
29982 
29983 namespace nmodl {
29984 namespace ast {
29985 
29986 /**
29987  * @addtogroup ast_class
29988  * @ingroup ast
29989  * @{
29990  */
29991 
29992 /**
29993  * \brief Represents CURIE information in NMODL
29994  *
29995  *
29996  */
29998 private:
29999  /// Ontology name
30000  std::shared_ptr<String> ontology_id;
30001  /// token with location information
30002  std::shared_ptr<ModToken> token;
30003 
30004 public:
30005  /// \name Ctor & dtor
30006  /// \{
30007 
30008  explicit OntologyStatement(String *ontology_id);
30009  explicit OntologyStatement(const std::shared_ptr<String> &ontology_id);
30011 
30012  virtual ~OntologyStatement() = default;
30013 
30014  /// \}
30015 
30016  /**
30017  * \brief Check if the ast node is an instance of ast::OntologyStatement
30018  * \return true as object is of type ast::OntologyStatement
30019  */
30020  bool is_ontology_statement() const noexcept override { return true; }
30021 
30022  /**
30023  * \brief Return a copy of the current node
30024  *
30025  * Recursively make a new copy/clone of the current node including
30026  * all members and return a pointer to the node. This is used for
30027  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30028  * ast.
30029  *
30030  * @return pointer to the clone/copy of the current node
30031  */
30032  OntologyStatement *clone() const override {
30033  return new OntologyStatement(*this);
30034  }
30035 
30036  /// \name Getters
30037  /// \{
30038 
30039  /**
30040  * \brief Return type (ast::AstNodeType) of ast node
30041  *
30042  * Every node in the ast has a type defined in ast::AstNodeType and this
30043  * function is used to retrieve the same.
30044  *
30045  * \return ast node type i.e. ast::AstNodeType::ONTOLOGY_STATEMENT
30046  *
30047  * \sa Ast::get_node_type_name
30048  */
30049  AstNodeType get_node_type() const noexcept override {
30051  }
30052 
30053  /**
30054  * \brief Return type (ast::AstNodeType) of ast node as std::string
30055  *
30056  * Every node in the ast has a type defined in ast::AstNodeType.
30057  * This type name can be returned as a std::string for printing
30058  * node to text/json form.
30059  *
30060  * \return name of the node type as a string i.e. "OntologyStatement"
30061  *
30062  * \sa Ast::get_node_name
30063  */
30064  std::string get_node_type_name() const noexcept override {
30065  return "OntologyStatement";
30066  }
30067 
30068  /**
30069  * \brief Return NMODL statement of ast node as std::string
30070  *
30071  * Every node is related to a special statement in the NMODL. This
30072  * statement can be returned as a std::string for printing to
30073  * text/json form.
30074  *
30075  * \return name of the statement as a string i.e. "REPRESENTS "
30076  *
30077  * \sa Ast::get_nmodl_name
30078  */
30079  std::string get_nmodl_name() const noexcept override { return "REPRESENTS "; }
30080 
30081  /**
30082  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30083  */
30084  std::shared_ptr<Ast> get_shared_ptr() override {
30085  return std::static_pointer_cast<OntologyStatement>(shared_from_this());
30086  }
30087 
30088  /**
30089  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30090  */
30091  std::shared_ptr<const Ast> get_shared_ptr() const override {
30092  return std::static_pointer_cast<const OntologyStatement>(
30093  shared_from_this());
30094  }
30095 
30096  /**
30097  * \brief Return associated token for the current ast node
30098  *
30099  * Not all ast nodes have token information. For example,
30100  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
30101  * solution of ODEs. In this case, we return nullptr to store in the
30102  * nmodl::symtab::SymbolTable.
30103  *
30104  * \return pointer to token if exist otherwise nullptr
30105  */
30106  const ModToken *get_token() const noexcept override { return token.get(); }
30107 
30108  /**
30109  * \brief Getter for member variable \ref OntologyStatement.ontology_id
30110  */
30111  const std::shared_ptr<String> &get_ontology_id() const noexcept {
30112  return ontology_id;
30113  }
30114 
30115  /// \}
30116 
30117  /// \name Setters
30118  /// \{
30119 
30120  /**
30121  * \brief Set token for the current ast node
30122  */
30123  void set_token(const ModToken &tok) {
30124  token = std::make_shared<ModToken>(tok);
30125  }
30126 
30127  /**
30128  * \brief Setter for member variable \ref OntologyStatement.ontology_id
30129  * (rvalue reference)
30130  */
30131  void set_ontology_id(std::shared_ptr<String> &&ontology_id);
30132 
30133  /**
30134  * \brief Setter for member variable \ref OntologyStatement.ontology_id
30135  */
30136  void set_ontology_id(const std::shared_ptr<String> &ontology_id);
30137 
30138  /// \}
30139 
30140  /// \name Visitor
30141  /// \{
30142 
30143  /**
30144  * \brief visit children i.e. member variables of current node using provided
30145  * visitor
30146  *
30147  * Different nodes in the AST have different members (i.e. children). This
30148  * method recursively visits children using provided visitor.
30149  *
30150  * \param v Concrete visitor that will be used to recursively visit children
30151  *
30152  * \sa Ast::visit_children for example.
30153  */
30154  void visit_children(visitor::Visitor &v) override;
30155 
30156  /**
30157  * \brief accept (or visit) the current AST node using provided visitor
30158  *
30159  * Instead of visiting children of AST node, like Ast::visit_children,
30160  * accept allows to visit the current node itself using provided concrete
30161  * visitor.
30162  *
30163  * \param v Concrete visitor that will be used to recursively visit node
30164  *
30165  * \sa Ast::accept for example.
30166  */
30167  void accept(visitor::Visitor &v) override;
30168 
30169  /// \}
30170 
30171 private:
30172  /**
30173  * \brief Set this object as parent for all the children
30174  *
30175  * This should be called in every object (with children) constructor
30176  * to set parents. Since it is called only in the constructors it
30177  * should not be virtual to avoid ambiguities (issue #295).
30178  */
30179  void set_parent_in_children();
30180 };
30181 
30182 /** @} */ // end of ast_class
30183 
30184 } // namespace ast
30185 } // namespace nmodl
30186 #endif // !NMODL_AST_ONTOLOGY_STATEMENT_HPP
30187 #ifndef NMODL_AST_PROGRAM_HPP
30188 #define NMODL_AST_PROGRAM_HPP
30189 
30190 namespace nmodl {
30191 namespace ast {
30192 
30193 /**
30194  * @addtogroup ast_class
30195  * @ingroup ast
30196  * @{
30197  */
30198 
30199 /**
30200  * \brief Represents top level AST node for whole NMODL input
30201  *
30202  *
30203  */
30204 class Program : public Ast {
30205 private:
30206  /// Vector of top level blocks in the mod file
30208  /// token with location information
30209  std::shared_ptr<ModToken> token;
30210  /// symbol table for a block
30211  symtab::SymbolTable *symtab = nullptr;
30212  /// global symbol table for model
30214 
30215 public:
30216  /// \name Ctor & dtor
30217  /// \{
30218 
30219  explicit Program(NodeVector blocks);
30220  Program(const Program &obj);
30221 
30222  Program() = default;
30223 
30224  virtual ~Program() = default;
30225 
30226  /// \}
30227 
30228  /**
30229  * \brief Check if the ast node is an instance of ast::Program
30230  * \return true as object is of type ast::Program
30231  */
30232  bool is_program() const noexcept override { return true; }
30233 
30234  /**
30235  * \brief Return a copy of the current node
30236  *
30237  * Recursively make a new copy/clone of the current node including
30238  * all members and return a pointer to the node. This is used for
30239  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30240  * ast.
30241  *
30242  * @return pointer to the clone/copy of the current node
30243  */
30244  Program *clone() const override { return new Program(*this); }
30245 
30246  /// \name Getters
30247  /// \{
30248 
30249  /**
30250  * \brief Return type (ast::AstNodeType) of ast node
30251  *
30252  * Every node in the ast has a type defined in ast::AstNodeType and this
30253  * function is used to retrieve the same.
30254  *
30255  * \return ast node type i.e. ast::AstNodeType::PROGRAM
30256  *
30257  * \sa Ast::get_node_type_name
30258  */
30259  AstNodeType get_node_type() const noexcept override {
30260  return AstNodeType::PROGRAM;
30261  }
30262 
30263  /**
30264  * \brief Return type (ast::AstNodeType) of ast node as std::string
30265  *
30266  * Every node in the ast has a type defined in ast::AstNodeType.
30267  * This type name can be returned as a std::string for printing
30268  * node to text/json form.
30269  *
30270  * \return name of the node type as a string i.e. "Program"
30271  *
30272  * \sa Ast::get_node_name
30273  */
30274  std::string get_node_type_name() const noexcept override { return "Program"; }
30275 
30276  /**
30277  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30278  */
30279  std::shared_ptr<Ast> get_shared_ptr() override {
30280  return std::static_pointer_cast<Program>(shared_from_this());
30281  }
30282 
30283  /**
30284  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30285  */
30286  std::shared_ptr<const Ast> get_shared_ptr() const override {
30287  return std::static_pointer_cast<const Program>(shared_from_this());
30288  }
30289 
30290  /**
30291  * \brief Return associated token for the current ast node
30292  *
30293  * Not all ast nodes have token information. For example,
30294  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
30295  * solution of ODEs. In this case, we return nullptr to store in the
30296  * nmodl::symtab::SymbolTable.
30297  *
30298  * \return pointer to token if exist otherwise nullptr
30299  */
30300  const ModToken *get_token() const noexcept override { return token.get(); }
30301 
30302  /**
30303  * \brief Return associated symbol table for the current ast node
30304  *
30305  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
30306  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
30307  * and it can be accessed using this method.
30308  *
30309  * \return pointer to the symbol table
30310  *
30311  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
30312  */
30313  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
30314 
30315  /**
30316  * \brief Return global symbol table for the mod file
30317  */
30319 
30320  /**
30321  * \brief Add member to blocks by raw pointer
30322  */
30324  blocks.emplace_back(n);
30325 
30326  // set parents
30327  n->set_parent(this);
30328  }
30329 
30330  /**
30331  * \brief Add member to blocks by shared_ptr
30332  */
30333  void emplace_back_node(std::shared_ptr<Node> n) {
30334  blocks.emplace_back(n);
30335  // set parents
30336  n->set_parent(this);
30337  }
30338 
30339  /**
30340  * \brief Erase member to blocks
30341  */
30342  NodeVector::const_iterator erase_node(NodeVector::const_iterator first) {
30343  auto first_it = const_iter_cast(blocks, first);
30344  return blocks.erase(first_it);
30345  }
30346  /**
30347  * \brief Erase members to blocks
30348  */
30349  NodeVector::const_iterator erase_node(NodeVector::const_iterator first,
30350  NodeVector::const_iterator last) {
30351  auto first_it = const_iter_cast(blocks, first);
30352  auto last_it = const_iter_cast(blocks, last);
30353  return blocks.erase(first_it, last_it);
30354  }
30355  /**
30356  * \brief Erase non-consecutive members to blocks
30357  *
30358  * loosely following the cpp reference of remove_if
30359  */
30360  size_t erase_node(std::unordered_set<Node *> &to_be_erased) {
30361  auto first = blocks.begin();
30362  auto last = blocks.end();
30363  auto result = first;
30364 
30365  while (first != last) {
30366  // automatically erase dangling pointers from the uset while
30367  // looking for them to erase them in the vector
30368  if (to_be_erased.erase(first->get()) == 0) {
30369  reset_node(result, *first);
30370  ++result;
30371  }
30372  ++first;
30373  }
30374 
30375  size_t out = last - result;
30376  erase_node(result, last);
30377 
30378  return out;
30379  }
30380 
30381  /**
30382  * \brief Insert member to blocks
30383  */
30384  NodeVector::const_iterator insert_node(NodeVector::const_iterator position,
30385  const std::shared_ptr<Node> &n) {
30386  n->set_parent(this);
30387  auto pos_it = const_iter_cast(blocks, position);
30388  return blocks.insert(pos_it, n);
30389  }
30390  /**
30391  * \brief Insert members to blocks
30392  */
30393  template <class NodeType, class InputIterator>
30394  void insert_node(NodeVector::const_iterator position, NodeType &to,
30395  InputIterator first, InputIterator last) {
30396 
30397  for (auto it = first; it != last; ++it) {
30398  auto &n = *it;
30399  // set parents
30400  n->set_parent(this);
30401  }
30402  auto pos_it = const_iter_cast(blocks, position);
30403  auto first_it = const_iter_cast(to, first);
30404  auto last_it = const_iter_cast(to, last);
30405  blocks.insert(pos_it, first_it, last_it);
30406  }
30407 
30408  /**
30409  * \brief Reset member to blocks
30410  */
30411  void reset_node(NodeVector::const_iterator position, Node *n) {
30412  // set parents
30413  n->set_parent(this);
30414 
30415  blocks[position - blocks.begin()].reset(n);
30416  }
30417 
30418  /**
30419  * \brief Reset member to blocks
30420  */
30421  void reset_node(NodeVector::const_iterator position,
30422  std::shared_ptr<Node> n) {
30423  // set parents
30424  n->set_parent(this);
30425 
30426  blocks[position - blocks.begin()] = n;
30427  }
30428 
30429  /**
30430  * \brief Getter for member variable \ref Program.blocks
30431  */
30432  const NodeVector &get_blocks() const noexcept { return blocks; }
30433 
30434  /// \}
30435 
30436  /// \name Setters
30437  /// \{
30438 
30439  /**
30440  * \brief Set token for the current ast node
30441  */
30442  void set_token(const ModToken &tok) {
30443  token = std::make_shared<ModToken>(tok);
30444  }
30445 
30446  /**
30447  * \brief Set symbol table for the current ast node
30448  *
30449  * Top level, block scoped nodes store symbol table in the ast node.
30450  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
30451  * for every node in the ast.
30452  *
30453  * \sa nmodl::visitor::SymtabVisitor
30454  */
30455  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
30456  symtab = newsymtab;
30457  }
30458 
30459  /**
30460  * \brief Setter for member variable \ref Program.blocks (rvalue reference)
30461  */
30462  void set_blocks(NodeVector &&blocks);
30463 
30464  /**
30465  * \brief Setter for member variable \ref Program.blocks
30466  */
30467  void set_blocks(const NodeVector &blocks);
30468 
30469  /// \}
30470 
30471  /// \name Visitor
30472  /// \{
30473 
30474  /**
30475  * \brief visit children i.e. member variables of current node using provided
30476  * visitor
30477  *
30478  * Different nodes in the AST have different members (i.e. children). This
30479  * method recursively visits children using provided visitor.
30480  *
30481  * \param v Concrete visitor that will be used to recursively visit children
30482  *
30483  * \sa Ast::visit_children for example.
30484  */
30485  void visit_children(visitor::Visitor &v) override;
30486 
30487  /**
30488  * \brief accept (or visit) the current AST node using provided visitor
30489  *
30490  * Instead of visiting children of AST node, like Ast::visit_children,
30491  * accept allows to visit the current node itself using provided concrete
30492  * visitor.
30493  *
30494  * \param v Concrete visitor that will be used to recursively visit node
30495  *
30496  * \sa Ast::accept for example.
30497  */
30498  void accept(visitor::Visitor &v) override;
30499 
30500  /// \}
30501 
30502 private:
30503  /**
30504  * \brief Set this object as parent for all the children
30505  *
30506  * This should be called in every object (with children) constructor
30507  * to set parents. Since it is called only in the constructors it
30508  * should not be virtual to avoid ambiguities (issue #295).
30509  */
30510  void set_parent_in_children();
30511 };
30512 
30513 /** @} */ // end of ast_class
30514 
30515 } // namespace ast
30516 } // namespace nmodl
30517 #endif // !NMODL_AST_PROGRAM_HPP
30518 #ifndef NMODL_AST_NRN_STATE_BLOCK_HPP
30519 #define NMODL_AST_NRN_STATE_BLOCK_HPP
30520 
30521 namespace nmodl {
30522 namespace ast {
30523 
30524 /**
30525  * @addtogroup ast_class
30526  * @ingroup ast
30527  * @{
30528  */
30529 
30530 /**
30531  * \brief Represents the coreneuron nrn_state callback function
30532  *
30533  *
30534  */
30535 class NrnStateBlock : public Block {
30536 private:
30537  /// solve blocks to be called or generated
30539  /// token with location information
30540  std::shared_ptr<ModToken> token;
30541  /// symbol table for a block
30542  symtab::SymbolTable *symtab = nullptr;
30543 
30544 public:
30545  /// \name Ctor & dtor
30546  /// \{
30547 
30548  explicit NrnStateBlock(StatementVector solve_statements);
30549  NrnStateBlock(const NrnStateBlock &obj);
30550 
30551  virtual ~NrnStateBlock() = default;
30552 
30553  /// \}
30554 
30555  /**
30556  * \brief Check if the ast node is an instance of ast::NrnStateBlock
30557  * \return true as object is of type ast::NrnStateBlock
30558  */
30559  bool is_nrn_state_block() const noexcept override { return true; }
30560 
30561  /**
30562  * \brief Return a copy of the current node
30563  *
30564  * Recursively make a new copy/clone of the current node including
30565  * all members and return a pointer to the node. This is used for
30566  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30567  * ast.
30568  *
30569  * @return pointer to the clone/copy of the current node
30570  */
30571  NrnStateBlock *clone() const override { return new NrnStateBlock(*this); }
30572 
30573  /// \name Getters
30574  /// \{
30575 
30576  /**
30577  * \brief Return type (ast::AstNodeType) of ast node
30578  *
30579  * Every node in the ast has a type defined in ast::AstNodeType and this
30580  * function is used to retrieve the same.
30581  *
30582  * \return ast node type i.e. ast::AstNodeType::NRN_STATE_BLOCK
30583  *
30584  * \sa Ast::get_node_type_name
30585  */
30586  AstNodeType get_node_type() const noexcept override {
30588  }
30589 
30590  /**
30591  * \brief Return type (ast::AstNodeType) of ast node as std::string
30592  *
30593  * Every node in the ast has a type defined in ast::AstNodeType.
30594  * This type name can be returned as a std::string for printing
30595  * node to text/json form.
30596  *
30597  * \return name of the node type as a string i.e. "NrnStateBlock"
30598  *
30599  * \sa Ast::get_node_name
30600  */
30601  std::string get_node_type_name() const noexcept override {
30602  return "NrnStateBlock";
30603  }
30604 
30605  /**
30606  * \brief Return NMODL statement of ast node as std::string
30607  *
30608  * Every node is related to a special statement in the NMODL. This
30609  * statement can be returned as a std::string for printing to
30610  * text/json form.
30611  *
30612  * \return name of the statement as a string i.e. "NRN_STATE "
30613  *
30614  * \sa Ast::get_nmodl_name
30615  */
30616  std::string get_nmodl_name() const noexcept override { return "NRN_STATE "; }
30617 
30618  /**
30619  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30620  */
30621  std::shared_ptr<Ast> get_shared_ptr() override {
30622  return std::static_pointer_cast<NrnStateBlock>(shared_from_this());
30623  }
30624 
30625  /**
30626  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30627  */
30628  std::shared_ptr<const Ast> get_shared_ptr() const override {
30629  return std::static_pointer_cast<const NrnStateBlock>(shared_from_this());
30630  }
30631 
30632  /**
30633  * \brief Return associated token for the current ast node
30634  *
30635  * Not all ast nodes have token information. For example,
30636  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
30637  * solution of ODEs. In this case, we return nullptr to store in the
30638  * nmodl::symtab::SymbolTable.
30639  *
30640  * \return pointer to token if exist otherwise nullptr
30641  */
30642  const ModToken *get_token() const noexcept override { return token.get(); }
30643 
30644  /**
30645  * \brief Return associated symbol table for the current ast node
30646  *
30647  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
30648  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
30649  * and it can be accessed using this method.
30650  *
30651  * \return pointer to the symbol table
30652  *
30653  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
30654  */
30655  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
30656 
30657  /**
30658  * \brief Getter for member variable \ref NrnStateBlock.solve_statements
30659  */
30660  const StatementVector &get_solve_statements() const noexcept {
30661  return solve_statements;
30662  }
30663 
30664  /// \}
30665 
30666  /// \name Setters
30667  /// \{
30668 
30669  /**
30670  * \brief Set token for the current ast node
30671  */
30672  void set_token(const ModToken &tok) {
30673  token = std::make_shared<ModToken>(tok);
30674  }
30675 
30676  /**
30677  * \brief Set symbol table for the current ast node
30678  *
30679  * Top level, block scoped nodes store symbol table in the ast node.
30680  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
30681  * for every node in the ast.
30682  *
30683  * \sa nmodl::visitor::SymtabVisitor
30684  */
30685  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
30686  symtab = newsymtab;
30687  }
30688 
30689  /**
30690  * \brief Setter for member variable \ref NrnStateBlock.solve_statements
30691  * (rvalue reference)
30692  */
30693  void set_solve_statements(StatementVector &&solve_statements);
30694 
30695  /**
30696  * \brief Setter for member variable \ref NrnStateBlock.solve_statements
30697  */
30698  void set_solve_statements(const StatementVector &solve_statements);
30699 
30700  /// \}
30701 
30702  /// \name Visitor
30703  /// \{
30704 
30705  /**
30706  * \brief visit children i.e. member variables of current node using provided
30707  * visitor
30708  *
30709  * Different nodes in the AST have different members (i.e. children). This
30710  * method recursively visits children using provided visitor.
30711  *
30712  * \param v Concrete visitor that will be used to recursively visit children
30713  *
30714  * \sa Ast::visit_children for example.
30715  */
30716  void visit_children(visitor::Visitor &v) override;
30717 
30718  /**
30719  * \brief accept (or visit) the current AST node using provided visitor
30720  *
30721  * Instead of visiting children of AST node, like Ast::visit_children,
30722  * accept allows to visit the current node itself using provided concrete
30723  * visitor.
30724  *
30725  * \param v Concrete visitor that will be used to recursively visit node
30726  *
30727  * \sa Ast::accept for example.
30728  */
30729  void accept(visitor::Visitor &v) override;
30730 
30731  /// \}
30732 
30733 private:
30734  /**
30735  * \brief Set this object as parent for all the children
30736  *
30737  * This should be called in every object (with children) constructor
30738  * to set parents. Since it is called only in the constructors it
30739  * should not be virtual to avoid ambiguities (issue #295).
30740  */
30741  void set_parent_in_children();
30742 };
30743 
30744 /** @} */ // end of ast_class
30745 
30746 } // namespace ast
30747 } // namespace nmodl
30748 #endif // !NMODL_AST_NRN_STATE_BLOCK_HPP
30749 #ifndef NMODL_AST_EIGEN_NEWTON_SOLVER_BLOCK_HPP
30750 #define NMODL_AST_EIGEN_NEWTON_SOLVER_BLOCK_HPP
30751 
30752 namespace nmodl {
30753 namespace ast {
30754 
30755 /**
30756  * @addtogroup ast_class
30757  * @ingroup ast
30758  * @{
30759  */
30760 
30761 /**
30762  * \brief Represent newton solver solution block based on Eigen
30763  *
30764  *
30765  */
30767 private:
30768  /// number of state vars used in solve
30769  std::shared_ptr<Integer> n_state_vars;
30770  /// Statements to be declared in the functor
30771  std::shared_ptr<StatementBlock> variable_block;
30772  /// Statement block to be executed before calling newton solver
30773  std::shared_ptr<StatementBlock> initialize_block;
30774  /// update X from states
30775  std::shared_ptr<StatementBlock> setup_x_block;
30776  /// odes as functor for eigen
30777  std::shared_ptr<StatementBlock> functor_block;
30778  /// update back states from X
30779  std::shared_ptr<StatementBlock> update_states_block;
30780  /// Statement block to be executed after calling newton solver
30781  std::shared_ptr<StatementBlock> finalize_block;
30782  /// token with location information
30783  std::shared_ptr<ModToken> token;
30784  /// symbol table for a block
30785  symtab::SymbolTable *symtab = nullptr;
30786 
30787 public:
30788  /// \name Ctor & dtor
30789  /// \{
30790 
30791  explicit EigenNewtonSolverBlock(Integer *n_state_vars,
30792  StatementBlock *variable_block,
30793  StatementBlock *initialize_block,
30794  StatementBlock *setup_x_block,
30795  StatementBlock *functor_block,
30796  StatementBlock *update_states_block,
30797  StatementBlock *finalize_block);
30798  explicit EigenNewtonSolverBlock(
30799  const std::shared_ptr<Integer> &n_state_vars,
30800  const std::shared_ptr<StatementBlock> &variable_block,
30801  const std::shared_ptr<StatementBlock> &initialize_block,
30802  const std::shared_ptr<StatementBlock> &setup_x_block,
30803  const std::shared_ptr<StatementBlock> &functor_block,
30804  const std::shared_ptr<StatementBlock> &update_states_block,
30805  const std::shared_ptr<StatementBlock> &finalize_block);
30807 
30808  virtual ~EigenNewtonSolverBlock() = default;
30809 
30810  /// \}
30811 
30812  /**
30813  * \brief Check if the ast node is an instance of ast::EigenNewtonSolverBlock
30814  * \return true as object is of type ast::EigenNewtonSolverBlock
30815  */
30816  bool is_eigen_newton_solver_block() const noexcept override { return true; }
30817 
30818  /**
30819  * \brief Return a copy of the current node
30820  *
30821  * Recursively make a new copy/clone of the current node including
30822  * all members and return a pointer to the node. This is used for
30823  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30824  * ast.
30825  *
30826  * @return pointer to the clone/copy of the current node
30827  */
30828  EigenNewtonSolverBlock *clone() const override {
30829  return new EigenNewtonSolverBlock(*this);
30830  }
30831 
30832  /// \name Getters
30833  /// \{
30834 
30835  /**
30836  * \brief Return type (ast::AstNodeType) of ast node
30837  *
30838  * Every node in the ast has a type defined in ast::AstNodeType and this
30839  * function is used to retrieve the same.
30840  *
30841  * \return ast node type i.e. ast::AstNodeType::EIGEN_NEWTON_SOLVER_BLOCK
30842  *
30843  * \sa Ast::get_node_type_name
30844  */
30845  AstNodeType get_node_type() const noexcept override {
30847  }
30848 
30849  /**
30850  * \brief Return type (ast::AstNodeType) of ast node as std::string
30851  *
30852  * Every node in the ast has a type defined in ast::AstNodeType.
30853  * This type name can be returned as a std::string for printing
30854  * node to text/json form.
30855  *
30856  * \return name of the node type as a string i.e. "EigenNewtonSolverBlock"
30857  *
30858  * \sa Ast::get_node_name
30859  */
30860  std::string get_node_type_name() const noexcept override {
30861  return "EigenNewtonSolverBlock";
30862  }
30863 
30864  /**
30865  * \brief Return NMODL statement of ast node as std::string
30866  *
30867  * Every node is related to a special statement in the NMODL. This
30868  * statement can be returned as a std::string for printing to
30869  * text/json form.
30870  *
30871  * \return name of the statement as a string i.e. "EIGEN_NEWTON_SOLVE"
30872  *
30873  * \sa Ast::get_nmodl_name
30874  */
30875  std::string get_nmodl_name() const noexcept override {
30876  return "EIGEN_NEWTON_SOLVE";
30877  }
30878 
30879  /**
30880  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30881  */
30882  std::shared_ptr<Ast> get_shared_ptr() override {
30883  return std::static_pointer_cast<EigenNewtonSolverBlock>(shared_from_this());
30884  }
30885 
30886  /**
30887  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30888  */
30889  std::shared_ptr<const Ast> get_shared_ptr() const override {
30890  return std::static_pointer_cast<const EigenNewtonSolverBlock>(
30891  shared_from_this());
30892  }
30893 
30894  /**
30895  * \brief Return associated token for the current ast node
30896  *
30897  * Not all ast nodes have token information. For example,
30898  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
30899  * solution of ODEs. In this case, we return nullptr to store in the
30900  * nmodl::symtab::SymbolTable.
30901  *
30902  * \return pointer to token if exist otherwise nullptr
30903  */
30904  const ModToken *get_token() const noexcept override { return token.get(); }
30905 
30906  /**
30907  * \brief Return associated symbol table for the current ast node
30908  *
30909  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
30910  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
30911  * and it can be accessed using this method.
30912  *
30913  * \return pointer to the symbol table
30914  *
30915  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
30916  */
30917  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
30918 
30919  /**
30920  * \brief Getter for member variable \ref EigenNewtonSolverBlock.n_state_vars
30921  */
30922  const std::shared_ptr<Integer> &get_n_state_vars() const noexcept {
30923  return n_state_vars;
30924  }
30925 
30926  /**
30927  * \brief Getter for member variable \ref
30928  * EigenNewtonSolverBlock.variable_block
30929  */
30930  const std::shared_ptr<StatementBlock> &get_variable_block() const noexcept {
30931  return variable_block;
30932  }
30933 
30934  /**
30935  * \brief Getter for member variable \ref
30936  * EigenNewtonSolverBlock.initialize_block
30937  */
30938  const std::shared_ptr<StatementBlock> &get_initialize_block() const noexcept {
30939  return initialize_block;
30940  }
30941 
30942  /**
30943  * \brief Getter for member variable \ref EigenNewtonSolverBlock.setup_x_block
30944  */
30945  const std::shared_ptr<StatementBlock> &get_setup_x_block() const noexcept {
30946  return setup_x_block;
30947  }
30948 
30949  /**
30950  * \brief Getter for member variable \ref EigenNewtonSolverBlock.functor_block
30951  */
30952  const std::shared_ptr<StatementBlock> &get_functor_block() const noexcept {
30953  return functor_block;
30954  }
30955 
30956  /**
30957  * \brief Getter for member variable \ref
30958  * EigenNewtonSolverBlock.update_states_block
30959  */
30960  const std::shared_ptr<StatementBlock> &get_update_states_block() const
30961  noexcept {
30962  return update_states_block;
30963  }
30964 
30965  /**
30966  * \brief Getter for member variable \ref
30967  * EigenNewtonSolverBlock.finalize_block
30968  */
30969  const std::shared_ptr<StatementBlock> &get_finalize_block() const noexcept {
30970  return finalize_block;
30971  }
30972 
30973  /// \}
30974 
30975  /// \name Setters
30976  /// \{
30977 
30978  /**
30979  * \brief Set token for the current ast node
30980  */
30981  void set_token(const ModToken &tok) {
30982  token = std::make_shared<ModToken>(tok);
30983  }
30984 
30985  /**
30986  * \brief Set symbol table for the current ast node
30987  *
30988  * Top level, block scoped nodes store symbol table in the ast node.
30989  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
30990  * for every node in the ast.
30991  *
30992  * \sa nmodl::visitor::SymtabVisitor
30993  */
30994  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
30995  symtab = newsymtab;
30996  }
30997 
30998  /**
30999  * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars
31000  * (rvalue reference)
31001  */
31002  void set_n_state_vars(std::shared_ptr<Integer> &&n_state_vars);
31003 
31004  /**
31005  * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars
31006  */
31007  void set_n_state_vars(const std::shared_ptr<Integer> &n_state_vars);
31008 
31009  /**
31010  * \brief Setter for member variable \ref
31011  * EigenNewtonSolverBlock.variable_block (rvalue reference)
31012  */
31013  void set_variable_block(std::shared_ptr<StatementBlock> &&variable_block);
31014 
31015  /**
31016  * \brief Setter for member variable \ref
31017  * EigenNewtonSolverBlock.variable_block
31018  */
31019  void
31020  set_variable_block(const std::shared_ptr<StatementBlock> &variable_block);
31021 
31022  /**
31023  * \brief Setter for member variable \ref
31024  * EigenNewtonSolverBlock.initialize_block (rvalue reference)
31025  */
31026  void set_initialize_block(std::shared_ptr<StatementBlock> &&initialize_block);
31027 
31028  /**
31029  * \brief Setter for member variable \ref
31030  * EigenNewtonSolverBlock.initialize_block
31031  */
31032  void
31033  set_initialize_block(const std::shared_ptr<StatementBlock> &initialize_block);
31034 
31035  /**
31036  * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block
31037  * (rvalue reference)
31038  */
31039  void set_setup_x_block(std::shared_ptr<StatementBlock> &&setup_x_block);
31040 
31041  /**
31042  * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block
31043  */
31044  void set_setup_x_block(const std::shared_ptr<StatementBlock> &setup_x_block);
31045 
31046  /**
31047  * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block
31048  * (rvalue reference)
31049  */
31050  void set_functor_block(std::shared_ptr<StatementBlock> &&functor_block);
31051 
31052  /**
31053  * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block
31054  */
31055  void set_functor_block(const std::shared_ptr<StatementBlock> &functor_block);
31056 
31057  /**
31058  * \brief Setter for member variable \ref
31059  * EigenNewtonSolverBlock.update_states_block (rvalue reference)
31060  */
31061  void set_update_states_block(
31062  std::shared_ptr<StatementBlock> &&update_states_block);
31063 
31064  /**
31065  * \brief Setter for member variable \ref
31066  * EigenNewtonSolverBlock.update_states_block
31067  */
31068  void set_update_states_block(
31069  const std::shared_ptr<StatementBlock> &update_states_block);
31070 
31071  /**
31072  * \brief Setter for member variable \ref
31073  * EigenNewtonSolverBlock.finalize_block (rvalue reference)
31074  */
31075  void set_finalize_block(std::shared_ptr<StatementBlock> &&finalize_block);
31076 
31077  /**
31078  * \brief Setter for member variable \ref
31079  * EigenNewtonSolverBlock.finalize_block
31080  */
31081  void
31082  set_finalize_block(const std::shared_ptr<StatementBlock> &finalize_block);
31083 
31084  /// \}
31085 
31086  /// \name Visitor
31087  /// \{
31088 
31089  /**
31090  * \brief visit children i.e. member variables of current node using provided
31091  * visitor
31092  *
31093  * Different nodes in the AST have different members (i.e. children). This
31094  * method recursively visits children using provided visitor.
31095  *
31096  * \param v Concrete visitor that will be used to recursively visit children
31097  *
31098  * \sa Ast::visit_children for example.
31099  */
31100  void visit_children(visitor::Visitor &v) override;
31101 
31102  /**
31103  * \brief accept (or visit) the current AST node using provided visitor
31104  *
31105  * Instead of visiting children of AST node, like Ast::visit_children,
31106  * accept allows to visit the current node itself using provided concrete
31107  * visitor.
31108  *
31109  * \param v Concrete visitor that will be used to recursively visit node
31110  *
31111  * \sa Ast::accept for example.
31112  */
31113  void accept(visitor::Visitor &v) override;
31114 
31115  /// \}
31116 
31117 private:
31118  /**
31119  * \brief Set this object as parent for all the children
31120  *
31121  * This should be called in every object (with children) constructor
31122  * to set parents. Since it is called only in the constructors it
31123  * should not be virtual to avoid ambiguities (issue #295).
31124  */
31125  void set_parent_in_children();
31126 };
31127 
31128 /** @} */ // end of ast_class
31129 
31130 } // namespace ast
31131 } // namespace nmodl
31132 #endif // !NMODL_AST_EIGEN_NEWTON_SOLVER_BLOCK_HPP
31133 #ifndef NMODL_AST_EIGEN_LINEAR_SOLVER_BLOCK_HPP
31134 #define NMODL_AST_EIGEN_LINEAR_SOLVER_BLOCK_HPP
31135 
31136 namespace nmodl {
31137 namespace ast {
31138 
31139 /**
31140  * @addtogroup ast_class
31141  * @ingroup ast
31142  * @{
31143  */
31144 
31145 /**
31146  * \brief Represent linear solver solution block based on Eigen
31147  *
31148  *
31149  */
31151 private:
31152  /// number of state vars used in solve
31153  std::shared_ptr<Integer> n_state_vars;
31154  /// Statements to be declared in the functor
31155  std::shared_ptr<StatementBlock> variable_block;
31156  /// Statement block to be executed before calling linear solver
31157  std::shared_ptr<StatementBlock> initialize_block;
31158  /// update X from states
31159  std::shared_ptr<StatementBlock> setup_x_block;
31160  /// update back states from X
31161  std::shared_ptr<StatementBlock> update_states_block;
31162  /// Statement block to be executed after calling linear solver
31163  std::shared_ptr<StatementBlock> finalize_block;
31164  /// token with location information
31165  std::shared_ptr<ModToken> token;
31166  /// symbol table for a block
31167  symtab::SymbolTable *symtab = nullptr;
31168 
31169 public:
31170  /// \name Ctor & dtor
31171  /// \{
31172 
31173  explicit EigenLinearSolverBlock(Integer *n_state_vars,
31174  StatementBlock *variable_block,
31175  StatementBlock *initialize_block,
31176  StatementBlock *setup_x_block,
31177  StatementBlock *update_states_block,
31178  StatementBlock *finalize_block);
31179  explicit EigenLinearSolverBlock(
31180  const std::shared_ptr<Integer> &n_state_vars,
31181  const std::shared_ptr<StatementBlock> &variable_block,
31182  const std::shared_ptr<StatementBlock> &initialize_block,
31183  const std::shared_ptr<StatementBlock> &setup_x_block,
31184  const std::shared_ptr<StatementBlock> &update_states_block,
31185  const std::shared_ptr<StatementBlock> &finalize_block);
31187 
31188  virtual ~EigenLinearSolverBlock() = default;
31189 
31190  /// \}
31191 
31192  /**
31193  * \brief Check if the ast node is an instance of ast::EigenLinearSolverBlock
31194  * \return true as object is of type ast::EigenLinearSolverBlock
31195  */
31196  bool is_eigen_linear_solver_block() const noexcept override { return true; }
31197 
31198  /**
31199  * \brief Return a copy of the current node
31200  *
31201  * Recursively make a new copy/clone of the current node including
31202  * all members and return a pointer to the node. This is used for
31203  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31204  * ast.
31205  *
31206  * @return pointer to the clone/copy of the current node
31207  */
31208  EigenLinearSolverBlock *clone() const override {
31209  return new EigenLinearSolverBlock(*this);
31210  }
31211 
31212  /// \name Getters
31213  /// \{
31214 
31215  /**
31216  * \brief Return type (ast::AstNodeType) of ast node
31217  *
31218  * Every node in the ast has a type defined in ast::AstNodeType and this
31219  * function is used to retrieve the same.
31220  *
31221  * \return ast node type i.e. ast::AstNodeType::EIGEN_LINEAR_SOLVER_BLOCK
31222  *
31223  * \sa Ast::get_node_type_name
31224  */
31225  AstNodeType get_node_type() const noexcept override {
31227  }
31228 
31229  /**
31230  * \brief Return type (ast::AstNodeType) of ast node as std::string
31231  *
31232  * Every node in the ast has a type defined in ast::AstNodeType.
31233  * This type name can be returned as a std::string for printing
31234  * node to text/json form.
31235  *
31236  * \return name of the node type as a string i.e. "EigenLinearSolverBlock"
31237  *
31238  * \sa Ast::get_node_name
31239  */
31240  std::string get_node_type_name() const noexcept override {
31241  return "EigenLinearSolverBlock";
31242  }
31243 
31244  /**
31245  * \brief Return NMODL statement of ast node as std::string
31246  *
31247  * Every node is related to a special statement in the NMODL. This
31248  * statement can be returned as a std::string for printing to
31249  * text/json form.
31250  *
31251  * \return name of the statement as a string i.e. "EIGEN_LINEAR_SOLVE"
31252  *
31253  * \sa Ast::get_nmodl_name
31254  */
31255  std::string get_nmodl_name() const noexcept override {
31256  return "EIGEN_LINEAR_SOLVE";
31257  }
31258 
31259  /**
31260  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31261  */
31262  std::shared_ptr<Ast> get_shared_ptr() override {
31263  return std::static_pointer_cast<EigenLinearSolverBlock>(shared_from_this());
31264  }
31265 
31266  /**
31267  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31268  */
31269  std::shared_ptr<const Ast> get_shared_ptr() const override {
31270  return std::static_pointer_cast<const EigenLinearSolverBlock>(
31271  shared_from_this());
31272  }
31273 
31274  /**
31275  * \brief Return associated token for the current ast node
31276  *
31277  * Not all ast nodes have token information. For example,
31278  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
31279  * solution of ODEs. In this case, we return nullptr to store in the
31280  * nmodl::symtab::SymbolTable.
31281  *
31282  * \return pointer to token if exist otherwise nullptr
31283  */
31284  const ModToken *get_token() const noexcept override { return token.get(); }
31285 
31286  /**
31287  * \brief Return associated symbol table for the current ast node
31288  *
31289  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
31290  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
31291  * and it can be accessed using this method.
31292  *
31293  * \return pointer to the symbol table
31294  *
31295  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
31296  */
31297  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
31298 
31299  /**
31300  * \brief Getter for member variable \ref EigenLinearSolverBlock.n_state_vars
31301  */
31302  const std::shared_ptr<Integer> &get_n_state_vars() const noexcept {
31303  return n_state_vars;
31304  }
31305 
31306  /**
31307  * \brief Getter for member variable \ref
31308  * EigenLinearSolverBlock.variable_block
31309  */
31310  const std::shared_ptr<StatementBlock> &get_variable_block() const noexcept {
31311  return variable_block;
31312  }
31313 
31314  /**
31315  * \brief Getter for member variable \ref
31316  * EigenLinearSolverBlock.initialize_block
31317  */
31318  const std::shared_ptr<StatementBlock> &get_initialize_block() const noexcept {
31319  return initialize_block;
31320  }
31321 
31322  /**
31323  * \brief Getter for member variable \ref EigenLinearSolverBlock.setup_x_block
31324  */
31325  const std::shared_ptr<StatementBlock> &get_setup_x_block() const noexcept {
31326  return setup_x_block;
31327  }
31328 
31329  /**
31330  * \brief Getter for member variable \ref
31331  * EigenLinearSolverBlock.update_states_block
31332  */
31333  const std::shared_ptr<StatementBlock> &get_update_states_block() const
31334  noexcept {
31335  return update_states_block;
31336  }
31337 
31338  /**
31339  * \brief Getter for member variable \ref
31340  * EigenLinearSolverBlock.finalize_block
31341  */
31342  const std::shared_ptr<StatementBlock> &get_finalize_block() const noexcept {
31343  return finalize_block;
31344  }
31345 
31346  /// \}
31347 
31348  /// \name Setters
31349  /// \{
31350 
31351  /**
31352  * \brief Set token for the current ast node
31353  */
31354  void set_token(const ModToken &tok) {
31355  token = std::make_shared<ModToken>(tok);
31356  }
31357 
31358  /**
31359  * \brief Set symbol table for the current ast node
31360  *
31361  * Top level, block scoped nodes store symbol table in the ast node.
31362  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
31363  * for every node in the ast.
31364  *
31365  * \sa nmodl::visitor::SymtabVisitor
31366  */
31367  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
31368  symtab = newsymtab;
31369  }
31370 
31371  /**
31372  * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars
31373  * (rvalue reference)
31374  */
31375  void set_n_state_vars(std::shared_ptr<Integer> &&n_state_vars);
31376 
31377  /**
31378  * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars
31379  */
31380  void set_n_state_vars(const std::shared_ptr<Integer> &n_state_vars);
31381 
31382  /**
31383  * \brief Setter for member variable \ref
31384  * EigenLinearSolverBlock.variable_block (rvalue reference)
31385  */
31386  void set_variable_block(std::shared_ptr<StatementBlock> &&variable_block);
31387 
31388  /**
31389  * \brief Setter for member variable \ref
31390  * EigenLinearSolverBlock.variable_block
31391  */
31392  void
31393  set_variable_block(const std::shared_ptr<StatementBlock> &variable_block);
31394 
31395  /**
31396  * \brief Setter for member variable \ref
31397  * EigenLinearSolverBlock.initialize_block (rvalue reference)
31398  */
31399  void set_initialize_block(std::shared_ptr<StatementBlock> &&initialize_block);
31400 
31401  /**
31402  * \brief Setter for member variable \ref
31403  * EigenLinearSolverBlock.initialize_block
31404  */
31405  void
31406  set_initialize_block(const std::shared_ptr<StatementBlock> &initialize_block);
31407 
31408  /**
31409  * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block
31410  * (rvalue reference)
31411  */
31412  void set_setup_x_block(std::shared_ptr<StatementBlock> &&setup_x_block);
31413 
31414  /**
31415  * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block
31416  */
31417  void set_setup_x_block(const std::shared_ptr<StatementBlock> &setup_x_block);
31418 
31419  /**
31420  * \brief Setter for member variable \ref
31421  * EigenLinearSolverBlock.update_states_block (rvalue reference)
31422  */
31423  void set_update_states_block(
31424  std::shared_ptr<StatementBlock> &&update_states_block);
31425 
31426  /**
31427  * \brief Setter for member variable \ref
31428  * EigenLinearSolverBlock.update_states_block
31429  */
31430  void set_update_states_block(
31431  const std::shared_ptr<StatementBlock> &update_states_block);
31432 
31433  /**
31434  * \brief Setter for member variable \ref
31435  * EigenLinearSolverBlock.finalize_block (rvalue reference)
31436  */
31437  void set_finalize_block(std::shared_ptr<StatementBlock> &&finalize_block);
31438 
31439  /**
31440  * \brief Setter for member variable \ref
31441  * EigenLinearSolverBlock.finalize_block
31442  */
31443  void
31444  set_finalize_block(const std::shared_ptr<StatementBlock> &finalize_block);
31445 
31446  /// \}
31447 
31448  /// \name Visitor
31449  /// \{
31450 
31451  /**
31452  * \brief visit children i.e. member variables of current node using provided
31453  * visitor
31454  *
31455  * Different nodes in the AST have different members (i.e. children). This
31456  * method recursively visits children using provided visitor.
31457  *
31458  * \param v Concrete visitor that will be used to recursively visit children
31459  *
31460  * \sa Ast::visit_children for example.
31461  */
31462  void visit_children(visitor::Visitor &v) override;
31463 
31464  /**
31465  * \brief accept (or visit) the current AST node using provided visitor
31466  *
31467  * Instead of visiting children of AST node, like Ast::visit_children,
31468  * accept allows to visit the current node itself using provided concrete
31469  * visitor.
31470  *
31471  * \param v Concrete visitor that will be used to recursively visit node
31472  *
31473  * \sa Ast::accept for example.
31474  */
31475  void accept(visitor::Visitor &v) override;
31476 
31477  /// \}
31478 
31479 private:
31480  /**
31481  * \brief Set this object as parent for all the children
31482  *
31483  * This should be called in every object (with children) constructor
31484  * to set parents. Since it is called only in the constructors it
31485  * should not be virtual to avoid ambiguities (issue #295).
31486  */
31487  void set_parent_in_children();
31488 };
31489 
31490 /** @} */ // end of ast_class
31491 
31492 } // namespace ast
31493 } // namespace nmodl
31494 #endif // !NMODL_AST_EIGEN_LINEAR_SOLVER_BLOCK_HPP
31495 #ifndef NMODL_AST_WRAPPED_EXPRESSION_HPP
31496 #define NMODL_AST_WRAPPED_EXPRESSION_HPP
31497 
31498 namespace nmodl {
31499 namespace ast {
31500 
31501 /**
31502  * @addtogroup ast_class
31503  * @ingroup ast
31504  * @{
31505  */
31506 
31507 /**
31508  * \brief Wrap any other expression type
31509  *
31510  *
31511  */
31513 private:
31514  /// Expression that is being wrapped
31515  std::shared_ptr<Expression> expression;
31516  /// token with location information
31517  std::shared_ptr<ModToken> token;
31518 
31519 public:
31520  /// \name Ctor & dtor
31521  /// \{
31522 
31523  explicit WrappedExpression(Expression *expression);
31524  explicit WrappedExpression(const std::shared_ptr<Expression> &expression);
31526 
31527  virtual ~WrappedExpression() = default;
31528 
31529  /// \}
31530 
31531  /**
31532  * \brief Check if the ast node is an instance of ast::WrappedExpression
31533  * \return true as object is of type ast::WrappedExpression
31534  */
31535  bool is_wrapped_expression() const noexcept override { return true; }
31536 
31537  /**
31538  * \brief Return a copy of the current node
31539  *
31540  * Recursively make a new copy/clone of the current node including
31541  * all members and return a pointer to the node. This is used for
31542  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31543  * ast.
31544  *
31545  * @return pointer to the clone/copy of the current node
31546  */
31547  WrappedExpression *clone() const override {
31548  return new WrappedExpression(*this);
31549  }
31550 
31551  /// \name Getters
31552  /// \{
31553 
31554  /**
31555  * \brief Return type (ast::AstNodeType) of ast node
31556  *
31557  * Every node in the ast has a type defined in ast::AstNodeType and this
31558  * function is used to retrieve the same.
31559  *
31560  * \return ast node type i.e. ast::AstNodeType::WRAPPED_EXPRESSION
31561  *
31562  * \sa Ast::get_node_type_name
31563  */
31564  AstNodeType get_node_type() const noexcept override {
31566  }
31567 
31568  /**
31569  * \brief Return type (ast::AstNodeType) of ast node as std::string
31570  *
31571  * Every node in the ast has a type defined in ast::AstNodeType.
31572  * This type name can be returned as a std::string for printing
31573  * node to text/json form.
31574  *
31575  * \return name of the node type as a string i.e. "WrappedExpression"
31576  *
31577  * \sa Ast::get_node_name
31578  */
31579  std::string get_node_type_name() const noexcept override {
31580  return "WrappedExpression";
31581  }
31582 
31583  /**
31584  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31585  */
31586  std::shared_ptr<Ast> get_shared_ptr() override {
31587  return std::static_pointer_cast<WrappedExpression>(shared_from_this());
31588  }
31589 
31590  /**
31591  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31592  */
31593  std::shared_ptr<const Ast> get_shared_ptr() const override {
31594  return std::static_pointer_cast<const WrappedExpression>(
31595  shared_from_this());
31596  }
31597 
31598  /**
31599  * \brief Return associated token for the current ast node
31600  *
31601  * Not all ast nodes have token information. For example,
31602  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
31603  * solution of ODEs. In this case, we return nullptr to store in the
31604  * nmodl::symtab::SymbolTable.
31605  *
31606  * \return pointer to token if exist otherwise nullptr
31607  */
31608  const ModToken *get_token() const noexcept override { return token.get(); }
31609 
31610  /**
31611  * \brief Getter for member variable \ref WrappedExpression.expression
31612  */
31613  const std::shared_ptr<Expression> &get_expression() const noexcept {
31614  return expression;
31615  }
31616 
31617  /// \}
31618 
31619  /// \name Setters
31620  /// \{
31621 
31622  /**
31623  * \brief Set token for the current ast node
31624  */
31625  void set_token(const ModToken &tok) {
31626  token = std::make_shared<ModToken>(tok);
31627  }
31628 
31629  /**
31630  * \brief Setter for member variable \ref WrappedExpression.expression (rvalue
31631  * reference)
31632  */
31633  void set_expression(std::shared_ptr<Expression> &&expression);
31634 
31635  /**
31636  * \brief Setter for member variable \ref WrappedExpression.expression
31637  */
31638  void set_expression(const std::shared_ptr<Expression> &expression);
31639 
31640  /// \}
31641 
31642  /// \name Visitor
31643  /// \{
31644 
31645  /**
31646  * \brief visit children i.e. member variables of current node using provided
31647  * visitor
31648  *
31649  * Different nodes in the AST have different members (i.e. children). This
31650  * method recursively visits children using provided visitor.
31651  *
31652  * \param v Concrete visitor that will be used to recursively visit children
31653  *
31654  * \sa Ast::visit_children for example.
31655  */
31656  void visit_children(visitor::Visitor &v) override;
31657 
31658  /**
31659  * \brief accept (or visit) the current AST node using provided visitor
31660  *
31661  * Instead of visiting children of AST node, like Ast::visit_children,
31662  * accept allows to visit the current node itself using provided concrete
31663  * visitor.
31664  *
31665  * \param v Concrete visitor that will be used to recursively visit node
31666  *
31667  * \sa Ast::accept for example.
31668  */
31669  void accept(visitor::Visitor &v) override;
31670 
31671  /// \}
31672 
31673 private:
31674  /**
31675  * \brief Set this object as parent for all the children
31676  *
31677  * This should be called in every object (with children) constructor
31678  * to set parents. Since it is called only in the constructors it
31679  * should not be virtual to avoid ambiguities (issue #295).
31680  */
31681  void set_parent_in_children();
31682 };
31683 
31684 /** @} */ // end of ast_class
31685 
31686 } // namespace ast
31687 } // namespace nmodl
31688 #endif // !NMODL_AST_WRAPPED_EXPRESSION_HPP
31689 #ifndef NMODL_AST_DERIVIMPLICIT_CALLBACK_HPP
31690 #define NMODL_AST_DERIVIMPLICIT_CALLBACK_HPP
31691 
31692 namespace nmodl {
31693 namespace ast {
31694 
31695 /**
31696  * @addtogroup ast_class
31697  * @ingroup ast
31698  * @{
31699  */
31700 
31701 /**
31702  * \brief Represent a callback to NEURON's derivimplicit solver
31703  *
31704  *
31705  */
31707 private:
31708  /// Block to be solved (typically derivative)
31709  std::shared_ptr<Block> node_to_solve;
31710  /// token with location information
31711  std::shared_ptr<ModToken> token;
31712 
31713 public:
31714  /// \name Ctor & dtor
31715  /// \{
31716 
31717  explicit DerivimplicitCallback(Block *node_to_solve);
31718  explicit DerivimplicitCallback(const std::shared_ptr<Block> &node_to_solve);
31720 
31721  virtual ~DerivimplicitCallback() = default;
31722 
31723  /// \}
31724 
31725  /**
31726  * \brief Check if the ast node is an instance of ast::DerivimplicitCallback
31727  * \return true as object is of type ast::DerivimplicitCallback
31728  */
31729  bool is_derivimplicit_callback() const noexcept override { return true; }
31730 
31731  /**
31732  * \brief Return a copy of the current node
31733  *
31734  * Recursively make a new copy/clone of the current node including
31735  * all members and return a pointer to the node. This is used for
31736  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31737  * ast.
31738  *
31739  * @return pointer to the clone/copy of the current node
31740  */
31741  DerivimplicitCallback *clone() const override {
31742  return new DerivimplicitCallback(*this);
31743  }
31744 
31745  /// \name Getters
31746  /// \{
31747 
31748  /**
31749  * \brief Return type (ast::AstNodeType) of ast node
31750  *
31751  * Every node in the ast has a type defined in ast::AstNodeType and this
31752  * function is used to retrieve the same.
31753  *
31754  * \return ast node type i.e. ast::AstNodeType::DERIVIMPLICIT_CALLBACK
31755  *
31756  * \sa Ast::get_node_type_name
31757  */
31758  AstNodeType get_node_type() const noexcept override {
31760  }
31761 
31762  /**
31763  * \brief Return type (ast::AstNodeType) of ast node as std::string
31764  *
31765  * Every node in the ast has a type defined in ast::AstNodeType.
31766  * This type name can be returned as a std::string for printing
31767  * node to text/json form.
31768  *
31769  * \return name of the node type as a string i.e. "DerivimplicitCallback"
31770  *
31771  * \sa Ast::get_node_name
31772  */
31773  std::string get_node_type_name() const noexcept override {
31774  return "DerivimplicitCallback";
31775  }
31776 
31777  /**
31778  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31779  */
31780  std::shared_ptr<Ast> get_shared_ptr() override {
31781  return std::static_pointer_cast<DerivimplicitCallback>(shared_from_this());
31782  }
31783 
31784  /**
31785  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31786  */
31787  std::shared_ptr<const Ast> get_shared_ptr() const override {
31788  return std::static_pointer_cast<const DerivimplicitCallback>(
31789  shared_from_this());
31790  }
31791 
31792  /**
31793  * \brief Return associated token for the current ast node
31794  *
31795  * Not all ast nodes have token information. For example,
31796  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
31797  * solution of ODEs. In this case, we return nullptr to store in the
31798  * nmodl::symtab::SymbolTable.
31799  *
31800  * \return pointer to token if exist otherwise nullptr
31801  */
31802  const ModToken *get_token() const noexcept override { return token.get(); }
31803 
31804  /**
31805  * \brief Getter for member variable \ref DerivimplicitCallback.node_to_solve
31806  */
31807  const std::shared_ptr<Block> &get_node_to_solve() const noexcept {
31808  return node_to_solve;
31809  }
31810 
31811  /// \}
31812 
31813  /// \name Setters
31814  /// \{
31815 
31816  /**
31817  * \brief Set token for the current ast node
31818  */
31819  void set_token(const ModToken &tok) {
31820  token = std::make_shared<ModToken>(tok);
31821  }
31822 
31823  /**
31824  * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve
31825  * (rvalue reference)
31826  */
31827  void set_node_to_solve(std::shared_ptr<Block> &&node_to_solve);
31828 
31829  /**
31830  * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve
31831  */
31832  void set_node_to_solve(const std::shared_ptr<Block> &node_to_solve);
31833 
31834  /// \}
31835 
31836  /// \name Visitor
31837  /// \{
31838 
31839  /**
31840  * \brief visit children i.e. member variables of current node using provided
31841  * visitor
31842  *
31843  * Different nodes in the AST have different members (i.e. children). This
31844  * method recursively visits children using provided visitor.
31845  *
31846  * \param v Concrete visitor that will be used to recursively visit children
31847  *
31848  * \sa Ast::visit_children for example.
31849  */
31850  void visit_children(visitor::Visitor &v) override;
31851 
31852  /**
31853  * \brief accept (or visit) the current AST node using provided visitor
31854  *
31855  * Instead of visiting children of AST node, like Ast::visit_children,
31856  * accept allows to visit the current node itself using provided concrete
31857  * visitor.
31858  *
31859  * \param v Concrete visitor that will be used to recursively visit node
31860  *
31861  * \sa Ast::accept for example.
31862  */
31863  void accept(visitor::Visitor &v) override;
31864 
31865  /// \}
31866 
31867 private:
31868  /**
31869  * \brief Set this object as parent for all the children
31870  *
31871  * This should be called in every object (with children) constructor
31872  * to set parents. Since it is called only in the constructors it
31873  * should not be virtual to avoid ambiguities (issue #295).
31874  */
31875  void set_parent_in_children();
31876 };
31877 
31878 /** @} */ // end of ast_class
31879 
31880 } // namespace ast
31881 } // namespace nmodl
31882 #endif // !NMODL_AST_DERIVIMPLICIT_CALLBACK_HPP
31883 #ifndef NMODL_AST_SOLUTION_EXPRESSION_HPP
31884 #define NMODL_AST_SOLUTION_EXPRESSION_HPP
31885 
31886 namespace nmodl {
31887 namespace ast {
31888 
31889 /**
31890  * @addtogroup ast_class
31891  * @ingroup ast
31892  * @{
31893  */
31894 
31895 /**
31896  * \brief Represent solution of a block in the AST
31897  *
31898  *
31899  */
31901 private:
31902  ///
31903  std::shared_ptr<SolveBlock> solve_block;
31904  /// Block to be solved (callback node or solution node itself)
31905  std::shared_ptr<Expression> node_to_solve;
31906  /// token with location information
31907  std::shared_ptr<ModToken> token;
31908 
31909 public:
31910  /// \name Ctor & dtor
31911  /// \{
31912 
31913  explicit SolutionExpression(SolveBlock *solve_block,
31914  Expression *node_to_solve);
31915  explicit SolutionExpression(const std::shared_ptr<SolveBlock> &solve_block,
31916  const std::shared_ptr<Expression> &node_to_solve);
31918 
31919  virtual ~SolutionExpression() = default;
31920 
31921  /// \}
31922 
31923  /**
31924  * \brief Check if the ast node is an instance of ast::SolutionExpression
31925  * \return true as object is of type ast::SolutionExpression
31926  */
31927  bool is_solution_expression() const noexcept override { return true; }
31928 
31929  /**
31930  * \brief Return a copy of the current node
31931  *
31932  * Recursively make a new copy/clone of the current node including
31933  * all members and return a pointer to the node. This is used for
31934  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31935  * ast.
31936  *
31937  * @return pointer to the clone/copy of the current node
31938  */
31939  SolutionExpression *clone() const override {
31940  return new SolutionExpression(*this);
31941  }
31942 
31943  /// \name Getters
31944  /// \{
31945 
31946  /**
31947  * \brief Return type (ast::AstNodeType) of ast node
31948  *
31949  * Every node in the ast has a type defined in ast::AstNodeType and this
31950  * function is used to retrieve the same.
31951  *
31952  * \return ast node type i.e. ast::AstNodeType::SOLUTION_EXPRESSION
31953  *
31954  * \sa Ast::get_node_type_name
31955  */
31956  AstNodeType get_node_type() const noexcept override {
31958  }
31959 
31960  /**
31961  * \brief Return type (ast::AstNodeType) of ast node as std::string
31962  *
31963  * Every node in the ast has a type defined in ast::AstNodeType.
31964  * This type name can be returned as a std::string for printing
31965  * node to text/json form.
31966  *
31967  * \return name of the node type as a string i.e. "SolutionExpression"
31968  *
31969  * \sa Ast::get_node_name
31970  */
31971  std::string get_node_type_name() const noexcept override {
31972  return "SolutionExpression";
31973  }
31974 
31975  /**
31976  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31977  */
31978  std::shared_ptr<Ast> get_shared_ptr() override {
31979  return std::static_pointer_cast<SolutionExpression>(shared_from_this());
31980  }
31981 
31982  /**
31983  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31984  */
31985  std::shared_ptr<const Ast> get_shared_ptr() const override {
31986  return std::static_pointer_cast<const SolutionExpression>(
31987  shared_from_this());
31988  }
31989 
31990  /**
31991  * \brief Return associated token for the current ast node
31992  *
31993  * Not all ast nodes have token information. For example,
31994  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
31995  * solution of ODEs. In this case, we return nullptr to store in the
31996  * nmodl::symtab::SymbolTable.
31997  *
31998  * \return pointer to token if exist otherwise nullptr
31999  */
32000  const ModToken *get_token() const noexcept override { return token.get(); }
32001 
32002  /**
32003  * \brief Getter for member variable \ref SolutionExpression.solve_block
32004  */
32005  const std::shared_ptr<SolveBlock> &get_solve_block() const noexcept {
32006  return solve_block;
32007  }
32008 
32009  /**
32010  * \brief Getter for member variable \ref SolutionExpression.node_to_solve
32011  */
32012  const std::shared_ptr<Expression> &get_node_to_solve() const noexcept {
32013  return node_to_solve;
32014  }
32015 
32016  /// \}
32017 
32018  /// \name Setters
32019  /// \{
32020 
32021  /**
32022  * \brief Set token for the current ast node
32023  */
32024  void set_token(const ModToken &tok) {
32025  token = std::make_shared<ModToken>(tok);
32026  }
32027 
32028  /**
32029  * \brief Setter for member variable \ref SolutionExpression.solve_block
32030  * (rvalue reference)
32031  */
32032  void set_solve_block(std::shared_ptr<SolveBlock> &&solve_block);
32033 
32034  /**
32035  * \brief Setter for member variable \ref SolutionExpression.solve_block
32036  */
32037  void set_solve_block(const std::shared_ptr<SolveBlock> &solve_block);
32038 
32039  /**
32040  * \brief Setter for member variable \ref SolutionExpression.node_to_solve
32041  * (rvalue reference)
32042  */
32043  void set_node_to_solve(std::shared_ptr<Expression> &&node_to_solve);
32044 
32045  /**
32046  * \brief Setter for member variable \ref SolutionExpression.node_to_solve
32047  */
32048  void set_node_to_solve(const std::shared_ptr<Expression> &node_to_solve);
32049 
32050  /// \}
32051 
32052  /// \name Visitor
32053  /// \{
32054 
32055  /**
32056  * \brief visit children i.e. member variables of current node using provided
32057  * visitor
32058  *
32059  * Different nodes in the AST have different members (i.e. children). This
32060  * method recursively visits children using provided visitor.
32061  *
32062  * \param v Concrete visitor that will be used to recursively visit children
32063  *
32064  * \sa Ast::visit_children for example.
32065  */
32066  void visit_children(visitor::Visitor &v) override;
32067 
32068  /**
32069  * \brief accept (or visit) the current AST node using provided visitor
32070  *
32071  * Instead of visiting children of AST node, like Ast::visit_children,
32072  * accept allows to visit the current node itself using provided concrete
32073  * visitor.
32074  *
32075  * \param v Concrete visitor that will be used to recursively visit node
32076  *
32077  * \sa Ast::accept for example.
32078  */
32079  void accept(visitor::Visitor &v) override;
32080 
32081  /// \}
32082 
32083 private:
32084  /**
32085  * \brief Set this object as parent for all the children
32086  *
32087  * This should be called in every object (with children) constructor
32088  * to set parents. Since it is called only in the constructors it
32089  * should not be virtual to avoid ambiguities (issue #295).
32090  */
32091  void set_parent_in_children();
32092 };
32093 
32094 /** @} */ // end of ast_class
32095 
32096 } // namespace ast
32097 } // namespace nmodl
32098 #endif // !NMODL_AST_SOLUTION_EXPRESSION_HPP
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:23797
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:16614
type of ast::DiscreteBlock
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13225
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12056
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14973
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13255
std::vector< std::shared_ptr< ExternVar > > ExternVarVector
Definition: ast_decl.hpp:359
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22296
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15116
std::shared_ptr< StatementBlock > ifsolerr
Block to be executed on error.
Definition: all.hpp:10676
static const std::string ReactionOpNames[]
string representation of ast::ReactionOp
Definition: ast_common.hpp:107
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10112
std::shared_ptr< Name > steadystate
Name of the integration method.
Definition: all.hpp:10674
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20668
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2210
std::shared_ptr< Expression > length
legth of an array or index position
Definition: all.hpp:2439
const std::shared_ptr< Integer > & get_with() const noexcept
Getter for member variable TableStatement::with.
Definition: all.hpp:26824
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4809
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16820
ThreadsafeVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5401
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:349
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5445
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5909
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:23016
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12261
type of ast::ConductanceHint
bool is_lag_statement() const noexcept override
Check if the ast node is an instance of ast::LagStatement.
Definition: all.hpp:26080
bool is_constant_statement() const noexcept override
Check if the ast node is an instance of ast::ConstantStatement.
Definition: all.hpp:26509
const NameVector & get_solvefor() const noexcept
Getter for member variable LinearBlock::solvefor.
Definition: all.hpp:8542
GlobalVarVector::const_iterator insert_global_var(GlobalVarVector::const_iterator position, const std::shared_ptr< GlobalVar > &n)
Insert member to variables.
Definition: all.hpp:28444
LocalListStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:19117
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5648
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11742
Represents SECTION variables statement in NMODL.
Definition: all.hpp:27876
type of ast::WrappedExpression
type of ast::NrnStateBlock
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5286
const std::shared_ptr< Expression > & get_value() const noexcept
Getter for member variable Watch::value.
Definition: all.hpp:17498
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9912
std::shared_ptr< Name > name
Name of the discrete block.
Definition: all.hpp:8976
static const std::string BATypeNames[]
string representation of ast::BAType
Definition: ast_common.hpp:95
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17695
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30002
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8761
const std::shared_ptr< StatementBlock > & get_setup_x_block() const noexcept
Getter for member variable EigenLinearSolverBlock::setup_x_block.
Definition: all.hpp:31325
bool is_unary_operator() const noexcept override
Check if the ast node is an instance of ast::UnaryOperator.
Definition: all.hpp:15328
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15191
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:23096
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26743
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23580
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:20522
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31907
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2961
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8519
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30540
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4838
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4235
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable Match::name.
Definition: all.hpp:17893
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4651
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5930
const std::shared_ptr< Name > & get_name2() const noexcept
Getter for member variable PartialBoundary::name2.
Definition: all.hpp:23862
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26965
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20118
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28875
bool is_non_linear_block() const noexcept override
Check if the ast node is an instance of ast::NonLinearBlock.
Definition: all.hpp:8719
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4033
bool is_reaction_operator() const noexcept override
Check if the ast node is an instance of ast::ReactionOperator.
Definition: all.hpp:15521
const SteppedVector & get_statements() const noexcept
Getter for member variable StepBlock::statements.
Definition: all.hpp:5948
const std::shared_ptr< StatementBlock > & get_finalize_block() const noexcept
Getter for member variable EigenLinearSolverBlock::finalize_block.
Definition: all.hpp:31342
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22605
Double * clone() const override
Return a copy of the current node.
Definition: all.hpp:1580
const std::shared_ptr< String > & get_statement() const noexcept
Getter for member variable LineComment::statement.
Definition: all.hpp:29700
virtual Block * clone() const override
Return a copy of the current node.
Definition: all.hpp:476
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:84
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18425
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9596
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27085
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19489
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18941
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31787
type of ast::FunctionCall
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable DiscreteBlock::name.
Definition: all.hpp:9116
type of ast::EigenLinearSolverBlock
AstNodeType
Enum type for every AST node type.
Definition: ast_decl.hpp:182
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24744
UnaryOp
enum type for unary operators
Definition: ast_common.hpp:74
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28853
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5874
virtual void accept(visitor::Visitor &v) override
accept (or visit) the current AST node using provided visitor
Definition: ast.cpp:353
std::shared_ptr< SolveBlock > solve_block
Definition: all.hpp:31903
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2033
Limits * clone() const override
Return a copy of the current node.
Definition: all.hpp:14298
ExpressionStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:21625
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:16835
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12588
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11512
std::shared_ptr< Name > name
Name of the non-linear block.
Definition: all.hpp:8690
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14064
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12790
bool is_param_assign() const noexcept override
Check if the ast node is an instance of ast::ParamAssign.
Definition: all.hpp:20062
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1382
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4764
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21231
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24917
Compartment * clone() const override
Return a copy of the current node.
Definition: all.hpp:25313
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15764
std::shared_ptr< Name > name
Name of the linear block.
Definition: all.hpp:8394
const NonspecificCurVarVector & get_currents() const noexcept
Getter for member variable Nonspecific::currents.
Definition: all.hpp:27578
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30981
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19404
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4019
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19149
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16805
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1148
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19949
std::shared_ptr< Unit > unit
Unit if specified.
Definition: all.hpp:9512
size_t erase_local_var(std::unordered_set< LocalVar *> &to_be_erased)
Erase non-consecutive members to variables.
Definition: all.hpp:19235
Represent token returned by scanner.
Definition: modtoken.hpp:50
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:21866
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29916
Range * clone() const override
Return a copy of the current node.
Definition: all.hpp:28108
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16374
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23550
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18082
float eval() const
Return value of the ast node.
Definition: all.hpp:1494
bool is_neuron_block() const noexcept override
Check if the ast node is an instance of ast::NeuronBlock.
Definition: all.hpp:13445
const std::shared_ptr< StatementBlock > & get_finalize_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::finalize_block.
Definition: all.hpp:30969
Represents a LAG statement in the mod file.
Definition: all.hpp:26054
Base class for all Abstract Syntax Tree node types.
Definition: ast.hpp:72
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:10178
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29274
std::shared_ptr< Integer > with
an increment factor
Definition: all.hpp:26691
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29073
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20040
bool is_watch() const noexcept override
Check if the ast node is an instance of ast::Watch.
Definition: all.hpp:17418
const std::shared_ptr< Unit > & get_unit2() const noexcept
Getter for member variable FactorDef::unit2.
Definition: all.hpp:18558
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27953
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15011
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable ParamAssign::unit.
Definition: all.hpp:20160
StatementVector::const_iterator erase_statement(StatementVector::const_iterator first)
Erase member to statements.
Definition: all.hpp:7903
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4966
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2670
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable IfStatement::statement_block.
Definition: all.hpp:22872
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31780
Represents LINEAR block in the NMODL.
Definition: all.hpp:8391
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3202
DerivimplicitCallback * clone() const override
Return a copy of the current node.
Definition: all.hpp:31741
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6112
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7865
Represents SUFFIX statement in NMODL.
Definition: all.hpp:26958
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:28151
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15742
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:5732
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25820
PartialEquation * clone() const override
Return a copy of the current node.
Definition: all.hpp:23492
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12839
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8980
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15177
static const std::string BinaryOpNames[]
string representation of ast::BinaryOp
Definition: ast_common.hpp:70
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21878
std::vector< std::shared_ptr< ThreadsafeVar > > ThreadsafeVarVector
Definition: ast_decl.hpp:360
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24615
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27026
DerivativeBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8151
const ElectrodeCurVarVector & get_currents() const noexcept
Getter for member variable ElctrodeCurrent::currents.
Definition: all.hpp:27783
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16985
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30672
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12217
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26137
bool is_ba_block() const noexcept override
Check if the ast node is an instance of ast::BABlock.
Definition: all.hpp:11952
std::vector< std::shared_ptr< PointerVar > > PointerVarVector
Definition: ast_decl.hpp:357
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable ForNetcon::parameters.
Definition: all.hpp:12293
type of ast::ForAllStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29712
const std::shared_ptr< Expression > & get_length() const noexcept
Getter for member variable IndexedName::length.
Definition: all.hpp:2553
bool is_line_comment() const noexcept override
Check if the ast node is an instance of ast::LineComment.
Definition: all.hpp:29625
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12709
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2983
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FactorDef::name.
Definition: all.hpp:18538
std::shared_ptr< Expression > increment
TODO.
Definition: all.hpp:21999
Represents TABLE statement in NMODL.
Definition: all.hpp:26680
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9351
const std::shared_ptr< Expression > & get_condition() const noexcept
Getter for member variable ElseIfStatement::condition.
Definition: all.hpp:23127
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20902
const ParamAssignVector & get_statements() const noexcept
Getter for member variable ParamBlock::statements.
Definition: all.hpp:5707
std::shared_ptr< String > statement
comment text
Definition: all.hpp:29796
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:22294
bool is_partial_equation() const noexcept override
Check if the ast node is an instance of ast::PartialEquation.
Definition: all.hpp:23480
Represent a callback to NEURON&#39;s derivimplicit solver.
Definition: all.hpp:31706
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3754
Represent queue statement in NMODL.
Definition: all.hpp:26274
void reset_statement(StatementVector::const_iterator position, std::shared_ptr< Statement > n)
Reset member to statements.
Definition: all.hpp:7984
bool is_for_netcon() const noexcept override
Check if the ast node is an instance of ast::ForNetcon.
Definition: all.hpp:12190
std::shared_ptr< Expression > lhs
TODO.
Definition: all.hpp:16534
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29899
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5958
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15220
bool is_react_var_name() const noexcept override
Check if the ast node is an instance of ast::ReactVarName.
Definition: all.hpp:3153
const std::shared_ptr< Name > & get_type() const noexcept
Getter for member variable Suffix::type.
Definition: all.hpp:27057
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable FunctionTableBlock::parameters.
Definition: all.hpp:9661
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19893
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20089
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1133
NonLinEquation * clone() const override
Return a copy of the current node.
Definition: all.hpp:16569
type of ast::ConstantVar
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:788
NodeVector blocks
Vector of top level blocks in the mod file.
Definition: all.hpp:30207
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29403
const std::shared_ptr< Number > & get_from() const noexcept
Getter for member variable AssignedDefinition::from.
Definition: all.hpp:20959
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16132
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26538
double value
Value of double.
Definition: all.hpp:1547
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17680
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14723
type of ast::PointerVar
std::shared_ptr< Integer > value
Value of the macro.
Definition: all.hpp:19603
std::shared_ptr< String > value
Value of name.
Definition: all.hpp:1984
type of ast::PartialBlock
Float * clone() const override
Return a copy of the current node.
Definition: all.hpp:1352
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:8480
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:23699
type of ast::BreakpointBlock
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4880
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:647
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22819
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9625
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15906
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:25517
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:16326
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24769
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27272
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:9245
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23147
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3830
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30875
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31711
const ElseIfStatementVector & get_elseifs() const noexcept
Getter for member variable IfStatement::elseifs.
Definition: all.hpp:22880
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:28349
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23365
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4623
std::shared_ptr< StatementBlock > initialize_block
Statement block to be executed before calling newton solver.
Definition: all.hpp:30773
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22003
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:7024
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9364
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9691
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2280
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27757
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26183
Represents a variable.
Definition: all.hpp:2661
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16626
bool is_match_block() const noexcept override
Check if the ast node is an instance of ast::MatchBlock.
Definition: all.hpp:12728
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13514
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30442
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6149
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11063
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5013
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10764
const std::shared_ptr< Name > & get_type() const noexcept
Getter for member variable Valence::type.
Definition: all.hpp:18787
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2737
type of ast::ExpressionStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16240
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9610
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1831
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2273
const std::shared_ptr< StatementBlock > & get_functor_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::functor_block.
Definition: all.hpp:30952
const std::shared_ptr< StatementBlock > & get_ifsolerr() const noexcept
Getter for member variable SolveBlock::ifsolerr.
Definition: all.hpp:10822
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3823
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9898
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:32000
UnaryOp value
TODO.
Definition: all.hpp:15307
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26834
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5170
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31354
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14354
bool is_queue_expression_type() const noexcept override
Check if the ast node is an instance of ast::QueueExpressionType.
Definition: all.hpp:17622
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11777
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7617
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:31367
WatchStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:24069
bool is_lin_equation() const noexcept override
Check if the ast node is an instance of ast::LinEquation.
Definition: all.hpp:16778
type of ast::IndependentBlock
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21455
External * clone() const override
Return a copy of the current node.
Definition: all.hpp:29028
NumberVector values
TODO.
Definition: all.hpp:20290
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23802
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23326
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22755
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21892
type of ast::LocalListStatement
type of ast::ReactionStatement
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable DerivativeBlock::statement_block.
Definition: all.hpp:8258
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:30685
type of ast::ElseIfStatement
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7273
std::shared_ptr< Expression > left_linxpression
TODO.
Definition: all.hpp:16755
void negate() override
Negate the value of current ast node.
Definition: all.hpp:1706
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2509
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11497
Represents ELECTRODE_CURRENT variables statement in NMODL.
Definition: all.hpp:27671
ConstructorBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7306
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ConstructorBlock::statement_block.
Definition: all.hpp:7399
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable PlotVar::name.
Definition: all.hpp:14769
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:106
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:32024
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25862
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12547
Represents specific element of an array variable.
Definition: all.hpp:2434
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7851
std::shared_ptr< String > value
Name of prime variable.
Definition: all.hpp:2206
QueueStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:26312
std::shared_ptr< Integer > value
TODO.
Definition: all.hpp:3130
NonspecificCurVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:3784
std::shared_ptr< Integer > n_state_vars
number of state vars used in solve
Definition: all.hpp:30769
bool is_before_block() const noexcept override
Check if the ast node is an instance of ast::BeforeBlock.
Definition: all.hpp:11470
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24126
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14750
bool is_partial_block() const noexcept override
Check if the ast node is an instance of ast::PartialBlock.
Definition: all.hpp:9268
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12520
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3641
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23347
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12601
bool is_number() const noexcept override
Check if the ast node is an instance of ast::Number.
Definition: all.hpp:739
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11566
const std::shared_ptr< StatementBlock > & get_variable_block() const noexcept
Getter for member variable EigenLinearSolverBlock::variable_block.
Definition: all.hpp:31310
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11994
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18802
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14138
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable NeuronBlock::statement_block.
Definition: all.hpp:13546
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29798
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18268
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable FunctionBlock::parameters.
Definition: all.hpp:9948
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:766
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6064
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19911
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9029
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:19906
bool is_derivimplicit_callback() const noexcept override
Check if the ast node is an instance of ast::DerivimplicitCallback.
Definition: all.hpp:31729
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11332
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13541
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:7525
bool is_else_if_statement() const noexcept override
Check if the ast node is an instance of ast::ElseIfStatement.
Definition: all.hpp:23039
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14677
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17031
type of ast::DoubleUnit
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22385
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:8776
LocalVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:14094
ElectrodeCurVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:3989
Represents a BREAKPOINT block in NMODL.
Definition: all.hpp:10975
BAType get_value() const noexcept
Getter for member variable BABlockType::value.
Definition: all.hpp:18101
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16389
std::shared_ptr< QueueExpressionType > qtype
queue type (put/get)
Definition: all.hpp:26277
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:30655
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20623
type of ast::UnaryOperator
bool is_non_lin_equation() const noexcept override
Check if the ast node is an instance of ast::NonLinEquation.
Definition: all.hpp:16557
virtual const ArgumentVector & get_parameters() const
Definition: all.hpp:454
Match * clone() const override
Return a copy of the current node.
Definition: all.hpp:17832
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11278
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24762
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20382
std::shared_ptr< Expression > condition
TODO.
Definition: all.hpp:22518
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3801
Represents a block to be executed before or after another block.
Definition: all.hpp:11924
std::shared_ptr< ConstantVar > constant
single constant variable
Definition: all.hpp:26489
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3004
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16840
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4478
GlobalVarVector::const_iterator erase_global_var(GlobalVarVector::const_iterator first)
Erase member to variables.
Definition: all.hpp:28400
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10198
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27239
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29099
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13572
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28701
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ConstantVar::name.
Definition: all.hpp:14991
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20341
std::shared_ptr< Name > name
Variable name.
Definition: all.hpp:4964
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5237
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3180
ArgumentVector parameters
Vector of the parameters.
Definition: all.hpp:10106
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27038
const std::shared_ptr< PlotDeclaration > & get_plot() const noexcept
Getter for member variable PlotBlock::plot.
Definition: all.hpp:6905
std::string value
Value of string.
Definition: all.hpp:872
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:7103
std::shared_ptr< StatementBlock > update_states_block
update back states from X
Definition: all.hpp:31161
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23767
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:21993
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:30455
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable FunctionBlock::statement_block.
Definition: all.hpp:9960
const ThreadsafeVarVector & get_variables() const noexcept
Getter for member variable ThreadSafe::variables.
Definition: all.hpp:29305
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26582
const std::shared_ptr< Expression > & get_to() const noexcept
Getter for member variable FromStatement::to.
Definition: all.hpp:22139
std::shared_ptr< StatementBlock > setup_x_block
update X from states
Definition: all.hpp:30775
VarName * clone() const override
Return a copy of the current node.
Definition: all.hpp:2702
Represent CONSERVE statement in NMODL.
Definition: all.hpp:25051
const StatementVector & get_solve_statements() const noexcept
Getter for member variable NrnStateBlock::solve_statements.
Definition: all.hpp:30660
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3873
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25653
bool is_double() const noexcept override
Check if the ast node is an instance of ast::Double.
Definition: all.hpp:1568
LocalVarVector::const_iterator erase_local_var(LocalVarVector::const_iterator first)
Erase member to variables.
Definition: all.hpp:19216
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14743
std::shared_ptr< Name > name1
TODO.
Definition: all.hpp:23705
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22422
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable WriteIonVar::name.
Definition: all.hpp:3659
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable BbcorePointerVar::name.
Definition: all.hpp:5074
ConductanceHint * clone() const override
Return a copy of the current node.
Definition: all.hpp:21403
BreakpointBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11013
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21642
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4228
Base class for all expressions in the NMODL.
Definition: all.hpp:308
FirstLastType value
TODO.
Definition: all.hpp:17201
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13487
const std::shared_ptr< Number > & get_value() const noexcept
Getter for member variable ParamAssign::value.
Definition: all.hpp:20155
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9147
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11772
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable DestructorBlock::statement_block.
Definition: all.hpp:7649
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24935
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17651
type of ast::ParamBlock
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19191
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:976
std::shared_ptr< Unit > unit
Unit for the variable.
Definition: all.hpp:14881
bool is_while_statement() const noexcept override
Check if the ast node is an instance of ast::WhileStatement.
Definition: all.hpp:22543
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28665
void emplace_back_watch(std::shared_ptr< Watch > n)
Add member to statements by shared_ptr.
Definition: all.hpp:24155
const SectionVarVector & get_sections() const noexcept
Getter for member variable Section::sections.
Definition: all.hpp:27984
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5668
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24084
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17445
bool is_pointer() const noexcept override
Check if the ast node is an instance of ast::Pointer.
Definition: all.hpp:28605
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:10110
Represent MUTEXLOCK statement in NMODL.
Definition: all.hpp:24345
Represents binary expression in the NMODL.
Definition: all.hpp:15897
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9134
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21189
Represents a string.
Definition: all.hpp:869
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13731
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:243
const std::shared_ptr< String > & get_value() const noexcept
Getter for member variable Name::value.
Definition: all.hpp:2092
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23809
TableStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:26728
bool is_double_unit() const noexcept override
Check if the ast node is an instance of ast::DoubleUnit.
Definition: all.hpp:13879
Wrap any other expression type.
Definition: all.hpp:31512
bool is_extern_var() const noexcept override
Check if the ast node is an instance of ast::ExternVar.
Definition: all.hpp:5188
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17060
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27515
std::shared_ptr< Name > name
Name of the macro.
Definition: all.hpp:19601
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:14062
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable IndependentDefinition::unit.
Definition: all.hpp:20658
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22522
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17910
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6797
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18111
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17293
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5371
ReactionOp
enum type used for Reaction statement
Definition: ast_common.hpp:104
std::vector< std::shared_ptr< Statement > > StatementVector
Definition: ast_decl.hpp:334
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23108
type of ast::ReactVarName
const std::shared_ptr< Double > & get_min() const noexcept
Getter for member variable Limits::min.
Definition: all.hpp:14359
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13267
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:1264
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22111
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27965
FirstLastType
enum type for partial equation types
Definition: ast_common.hpp:80
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21671
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24601
std::string eval() const
Return enum value in string form.
Definition: all.hpp:18160
LinearBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8435
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23713
const std::shared_ptr< Name > & get_steadystate() const noexcept
Getter for member variable SolveBlock::steadystate.
Definition: all.hpp:10815
Represents a C code block.
Definition: all.hpp:29398
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17862
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:19477
const std::shared_ptr< String > & get_ontology_id() const noexcept
Getter for member variable Useion::ontology_id.
Definition: all.hpp:27333
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18897
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:513
void reset_statement(StatementVector::const_iterator position, Statement *n)
Reset member to statements.
Definition: all.hpp:7974
EigenLinearSolverBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:31208
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2990
std::shared_ptr< Number > from
TODO.
Definition: all.hpp:20514
bool is_global() const noexcept override
Check if the ast node is an instance of ast::Global.
Definition: all.hpp:28294
const std::shared_ptr< String > & get_filename() const noexcept
Getter for member variable Include::filename.
Definition: all.hpp:19937
Operator used in ast::BinaryExpression.
Definition: all.hpp:15111
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21664
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:640
std::shared_ptr< Integer > order
order of ODE
Definition: all.hpp:2208
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31564
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7115
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4407
Represent solution of a block in the AST.
Definition: all.hpp:31900
std::shared_ptr< Expression > reaction1
TODO.
Definition: all.hpp:25757
std::vector< std::shared_ptr< ParamAssign > > ParamAssignVector
Definition: ast_decl.hpp:426
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28361
const std::shared_ptr< Number > & get_value() const noexcept
Getter for member variable ConstantVar::value.
Definition: all.hpp:14996
Represents POINTER statement in NMODL.
Definition: all.hpp:28583
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16209
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27530
type of ast::ConstantStatement
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Stepped::name.
Definition: all.hpp:20387
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14131
const std::shared_ptr< Integer > & get_with() const noexcept
Getter for member variable IndependentDefinition::with.
Definition: all.hpp:20648
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28375
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12020
const std::shared_ptr< Expression > & get_expr() const noexcept
Getter for member variable Conserve::expr.
Definition: all.hpp:25172
UnaryOperator * clone() const override
Return a copy of the current node.
Definition: all.hpp:15340
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable Valence::value.
Definition: all.hpp:18792
ReactionOperator * clone() const override
Return a copy of the current node.
Definition: all.hpp:15533
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:10759
ReactionOp get_value() const noexcept
Getter for member variable ReactionOperator::value.
Definition: all.hpp:15598
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9973
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1615
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17264
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30279
const std::shared_ptr< String > & get_name() const noexcept
Getter for member variable Unit::name.
Definition: all.hpp:13763
std::vector< std::shared_ptr< RangeVar > > RangeVarVector
Definition: ast_decl.hpp:355
const std::shared_ptr< Integer > & get_index() const noexcept
Getter for member variable PlotVar::index.
Definition: all.hpp:14774
const std::shared_ptr< String > & get_title() const noexcept
Getter for member variable Model::title.
Definition: all.hpp:19508
bool is_nrn_state_block() const noexcept override
Check if the ast node is an instance of ast::NrnStateBlock.
Definition: all.hpp:30559
type of ast::ConstantBlock
const NameVector & get_depend_vars() const noexcept
Getter for member variable TableStatement::depend_vars.
Definition: all.hpp:26809
ReadIonVarVector readlist
Variables being read.
Definition: all.hpp:27180
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:7605
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:8196
NameVector solvefor
TODO.
Definition: all.hpp:8396
const std::shared_ptr< Integer > & get_length() const noexcept
Getter for member variable AssignedDefinition::length.
Definition: all.hpp:20954
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5719
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Define::name.
Definition: all.hpp:19723
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29681
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24389
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:506
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30091
bool is_assigned_definition() const noexcept override
Check if the ast node is an instance of ast::AssignedDefinition.
Definition: all.hpp:20858
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:10480
type of ast::Verbatim
const std::shared_ptr< VarName > & get_name() const noexcept
Getter for member variable ReactVarName::name.
Definition: all.hpp:3246
Define * clone() const override
Return a copy of the current node.
Definition: all.hpp:19636
std::shared_ptr< Block > node_to_solve
Block to be solved (typically derivative)
Definition: all.hpp:31709
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13659
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:3350
Represents GLOBAL statement in NMODL.
Definition: all.hpp:28272
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27545
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10502
IndexedName * clone() const override
Return a copy of the current node.
Definition: all.hpp:2472
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13507
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30259
std::vector< T >::iterator const_iter_cast(std::vector< T > &v, typename std::vector< T >::const_iterator iter)
Return non-const iterator corresponding to the const_iterator in a vector.
type of ast::ElseStatement
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25855
Represents a AFTER block in NMODL.
Definition: after_block.hpp:55
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable AssignedDefinition::name.
Definition: all.hpp:20949
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19088
Represents a CONSTRUCTOR block in the NMODL.
Definition: all.hpp:7268
const std::shared_ptr< Number > & get_to() const noexcept
Getter for member variable AssignedDefinition::to.
Definition: all.hpp:20964
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24140
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23333
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable DiscreteBlock::statement_block.
Definition: all.hpp:9121
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28588
std::shared_ptr< PlotDeclaration > plot
Vector of plot variables.
Definition: all.hpp:6795
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable ProtectStatement::expression.
Definition: all.hpp:21897
Represent a single variable of type BBCOREPOINTER.
Definition: all.hpp:4961
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11841
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31773
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29695
bool is_destructor_block() const noexcept override
Check if the ast node is an instance of ast::DestructorBlock.
Definition: all.hpp:7548
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:25277
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14560
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31985
bool is_number_range() const noexcept override
Check if the ast node is an instance of ast::NumberRange.
Definition: all.hpp:14490
std::vector< std::shared_ptr< Node > > NodeVector
Definition: ast_decl.hpp:333
const std::shared_ptr< Unit > & get_unit1() const noexcept
Getter for member variable UnitDef::unit1.
Definition: all.hpp:18307
Represents a INITIAL block in the NMODL.
Definition: all.hpp:7021
Include * clone() const override
Return a copy of the current node.
Definition: all.hpp:19863
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:491
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable ParenExpression::expression.
Definition: all.hpp:15790
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13013
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20608
type of ast::LinearBlock
Represents a one line comment in NMODL.
Definition: all.hpp:29602
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26342
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7142
std::shared_ptr< String > statement
C code as a string.
Definition: all.hpp:29401
type of ast::StateBlock
float get_value() const noexcept
Getter for member variable Float::value.
Definition: all.hpp:1413
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:13858
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5675
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26349
void negate() override
Negate the value of current ast node.
Definition: all.hpp:1922
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19176
std::shared_ptr< Name > name
Name of the derivative block.
Definition: all.hpp:8113
std::shared_ptr< Expression > react
TODO.
Definition: all.hpp:25054
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23529
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable Argument::unit.
Definition: all.hpp:3027
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14374
const VarNameVector & get_variables() const noexcept
Getter for member variable Sens::variables.
Definition: all.hpp:24961
const std::shared_ptr< StatementBlock > & get_update_states_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::update_states_block.
Definition: all.hpp:30960
const RangeVarVector & get_variables() const noexcept
Getter for member variable Range::variables.
Definition: all.hpp:28182
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11350
bool is_limits() const noexcept override
Check if the ast node is an instance of ast::Limits.
Definition: all.hpp:14286
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2732
const std::shared_ptr< StatementBlock > & get_update_states_block() const noexcept
Getter for member variable EigenLinearSolverBlock::update_states_block.
Definition: all.hpp:31333
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24942
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15785
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25521
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable KineticBlock::name.
Definition: all.hpp:12565
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ElseStatement::statement_block.
Definition: all.hpp:23352
Boolean * clone() const override
Return a copy of the current node.
Definition: all.hpp:1796
symtab::ModelSymbolTable * get_model_symbol_table()
Return global symbol table for the mod file.
Definition: all.hpp:30318
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:20828
bool is_reset() const noexcept override
Check if the ast node is an instance of ast::Reset.
Definition: all.hpp:24702
const std::shared_ptr< Name > & get_name1() const noexcept
Getter for member variable PartialEquation::name1.
Definition: all.hpp:23560
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4563
const std::shared_ptr< Integer > & get_value() const noexcept
Getter for member variable ReactVarName::value.
Definition: all.hpp:3228
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:20512
bool is_block() const noexcept override
Check if the ast node is an instance of ast::Block.
Definition: all.hpp:464
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12168
const std::shared_ptr< Integer > & get_n_state_vars() const noexcept
Getter for member variable EigenLinearSolverBlock::n_state_vars.
Definition: all.hpp:31302
Represent statement in CONSTANT block of NMODL.
Definition: all.hpp:26486
std::shared_ptr< Double > max
TODO.
Definition: all.hpp:14265
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28896
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27979
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8856
type of ast::NonLinearBlock
const std::shared_ptr< Expression > & get_condition() const noexcept
Getter for member variable IfStatement::condition.
Definition: all.hpp:22865
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7575
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5431
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4360
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13935
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8506
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1086
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8018
bool is_partial_boundary() const noexcept override
Check if the ast node is an instance of ast::PartialBoundary.
Definition: all.hpp:23740
Represents top level AST node for whole NMODL input.
Definition: all.hpp:30204
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1636
bool is_queue_statement() const noexcept override
Check if the ast node is an instance of ast::QueueStatement.
Definition: all.hpp:26300
void emplace_back_node(Node *n)
Add member to blocks by raw pointer.
Definition: all.hpp:30323
AssignedDefinition * clone() const override
Return a copy of the current node.
Definition: all.hpp:20870
NonLinearBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8731
OntologyStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:30032
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20887
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4824
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:30917
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20104
IfStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:22789
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:8115
void reset_local_var(LocalVarVector::const_iterator position, std::shared_ptr< LocalVar > n)
Reset member to variables.
Definition: all.hpp:19297
FunctionCall * clone() const override
Return a copy of the current node.
Definition: all.hpp:17016
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22070
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:12166
std::shared_ptr< Expression > from
TODO.
Definition: all.hpp:21995
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19738
const std::shared_ptr< Expression > & get_reaction2() const noexcept
Getter for member variable ReactionStatement::reaction2.
Definition: all.hpp:25894
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:10219
bool is_name() const noexcept override
Check if the ast node is an instance of ast::Name.
Definition: all.hpp:2006
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9330
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31978
Represents a STEPPED block in the NMODL.
Definition: all.hpp:5823
const std::shared_ptr< Name > & get_ion() const noexcept
Getter for member variable ConductanceHint::ion.
Definition: all.hpp:21488
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:28660
String * clone() const override
Return a copy of the current node.
Definition: all.hpp:905
Valence * clone() const override
Return a copy of the current node.
Definition: all.hpp:18726
Pointer * clone() const override
Return a copy of the current node.
Definition: all.hpp:28617
std::shared_ptr< Expression > to
TODO.
Definition: all.hpp:21997
bool is_global_var() const noexcept override
Check if the ast node is an instance of ast::GlobalVar.
Definition: all.hpp:4581
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14267
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:23703
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18999
const std::shared_ptr< Boolean > & get_gt() const noexcept
Getter for member variable FactorDef::gt.
Definition: all.hpp:18553
PlotVarVector variables
TODO.
Definition: all.hpp:21139
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:30994
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25370
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22626
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15956
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24559
ConstantBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:13210
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29085
std::shared_ptr< Number > from
TODO.
Definition: all.hpp:20822
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15565
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12824
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20356
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4206
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:12247
std::shared_ptr< StatementBlock > functor_block
odes as functor for eigen
Definition: all.hpp:30777
NameVector table_vars
Variables in the table.
Definition: all.hpp:26683
ReadIonVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:3382
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:25275
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19449
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14517
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6917
type of ast::Nonspecific
AssignedDefinitionVector definitions
Vector of state variables.
Definition: all.hpp:6556
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable NonspecificCurVar::name.
Definition: all.hpp:3863
LinEquation * clone() const override
Return a copy of the current node.
Definition: all.hpp:16790
BinaryExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:15939
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16599
bool is_binary_operator() const noexcept override
Check if the ast node is an instance of ast::BinaryOperator.
Definition: all.hpp:15135
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:10193
std::shared_ptr< Integer > at
Value specified with @
Definition: all.hpp:2666
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15205
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ReadIonVar::name.
Definition: all.hpp:3458
LocalVarVector::const_iterator insert_local_var(LocalVarVector::const_iterator position, const std::shared_ptr< LocalVar > &n)
Insert member to variables.
Definition: all.hpp:19260
const std::shared_ptr< Name > & get_name3() const noexcept
Getter for member variable PartialEquation::name3.
Definition: all.hpp:23570
virtual Identifier * clone() const override
Return a copy of the current node.
Definition: all.hpp:610
ArgumentVector parameters
Vector of the parameters.
Definition: all.hpp:9799
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7394
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:10163
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2048
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7844
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7381
FunctionTableBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9549
type of ast::BeforeBlock
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable LagStatement::name.
Definition: all.hpp:26168
WatchVector statements
Vector of watch statements.
Definition: all.hpp:24038
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:5702
Represent CONSTANT block in the mod file.
Definition: all.hpp:13174
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17203
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6859
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2060
std::vector< std::shared_ptr< Number > > NumberVector
Definition: ast_decl.hpp:338
bool is_useion() const noexcept override
Check if the ast node is an instance of ast::Useion.
Definition: all.hpp:27212
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5084
Represents a ASSIGNED block in the NMODL.
Definition: all.hpp:6309
const std::shared_ptr< Name > & get_conductance() const noexcept
Getter for member variable ConductanceHint::conductance.
Definition: all.hpp:21481
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9581
Represents RANGE variables statement in NMODL.
Definition: all.hpp:28074
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22378
const std::shared_ptr< Name > & get_block_name() const noexcept
Getter for member variable SolveBlock::block_name.
Definition: all.hpp:10803
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11811
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable DoubleUnit::unit.
Definition: all.hpp:13959
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23536
BABlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11964
type of ast::PartialBoundary
GlobalVarVector::const_iterator erase_global_var(GlobalVarVector::const_iterator first, GlobalVarVector::const_iterator last)
Erase members to variables.
Definition: all.hpp:28408
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21224
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30084
bool is_kinetic_block() const noexcept override
Check if the ast node is an instance of ast::KineticBlock.
Definition: all.hpp:12451
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:795
const GlobalVarVector & get_variables() const noexcept
Getter for member variable Global::variables.
Definition: all.hpp:28493
std::shared_ptr< String > statement
comment text
Definition: all.hpp:29605
type of ast::ProtectStatement
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26327
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8788
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30845
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27764
type of ast::External
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1394
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9085
bool is_identifier() const noexcept override
Check if the ast node is an instance of ast::Identifier.
Definition: all.hpp:598
Represents a BEFORE block in NMODL.
Definition: all.hpp:11445
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:21448
Represent symbol table for a NMODL block.
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31758
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11298
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25058
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5587
std::shared_ptr< StatementBlock > variable_block
Statements to be declared in the functor.
Definition: all.hpp:31155
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18202
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17874
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable UnaryExpression::expression.
Definition: all.hpp:16427
encapsulates everything related to NMODL code generation framework
Definition: ast_common.hpp:26
const std::shared_ptr< Integer > & get_n_state_vars() const noexcept
Getter for member variable EigenNewtonSolverBlock::n_state_vars.
Definition: all.hpp:30922
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27254
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FunctionCall::name.
Definition: all.hpp:17092
type of ast::MatchBlock
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13425
ThreadsafeVarVector variables
Vector of thread safe variables.
Definition: all.hpp:29198
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3959
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22612
std::shared_ptr< Expression > condition
TODO.
Definition: all.hpp:23014
bool is_initial_block() const noexcept override
Check if the ast node is an instance of ast::InitialBlock.
Definition: all.hpp:7046
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3256
std::shared_ptr< Name > name
Name of the channel.
Definition: all.hpp:26963
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24930
std::shared_ptr< PrimeName > prime
TODO.
Definition: all.hpp:23450
const UnaryOperator & get_op() const noexcept
Getter for member variable UnaryExpression::op.
Definition: all.hpp:16422
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26392
std::vector< std::shared_ptr< ElseIfStatement > > ElseIfStatementVector
Definition: ast_decl.hpp:441
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable NonLinearBlock::name.
Definition: all.hpp:8833
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:3551
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:21787
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19464
ElseStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:23276
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:3957
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27590
void reset_global_var(GlobalVarVector::const_iterator position, GlobalVar *n)
Reset member to variables.
Definition: all.hpp:28471
bool is_independent_definition() const noexcept override
Check if the ast node is an instance of ast::IndependentDefinition.
Definition: all.hpp:20550
bool is_elctrode_current() const noexcept override
Check if the ast node is an instance of ast::ElctrodeCurrent.
Definition: all.hpp:27693
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11828
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1838
IndependentBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:6095
const IndependentDefinitionVector & get_definitions() const noexcept
Getter for member variable IndependentBlock::definitions.
Definition: all.hpp:6188
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29843
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:364
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23081
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29078
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4221
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9986
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12326
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:920
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ForNetcon::statement_block.
Definition: all.hpp:12300
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31593
std::shared_ptr< Boolean > sweep
TODO.
Definition: all.hpp:20510
std::shared_ptr< Name > name
Name of the procedure.
Definition: all.hpp:10104
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29114
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26560
std::vector< std::shared_ptr< Name > > NameVector
Definition: ast_decl.hpp:344
IndependentDefinition * clone() const override
Return a copy of the current node.
Definition: all.hpp:20562
std::shared_ptr< Name > block_name
Name of the block to solve.
Definition: all.hpp:10670
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24264
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31819
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3412
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:25850
Watch * clone() const override
Return a copy of the current node.
Definition: all.hpp:17430
BinaryOperator * clone() const override
Return a copy of the current node.
Definition: all.hpp:15147
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:1927
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22846
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:6930
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16223
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31284
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16195
Represents DERIVATIVE block in the NMODL.
Definition: all.hpp:8110
std::shared_ptr< StatementBlock > update_states_block
update back states from X
Definition: all.hpp:30779
void insert_watch(WatchVector::const_iterator position, NodeType &to, InputIterator first, InputIterator last)
Insert members to statements.
Definition: all.hpp:24216
UnitStateType value
TODO.
Definition: all.hpp:18895
ProtectStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:21819
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:22085
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:961
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27267
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11539
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18520
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20524
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:10413
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3598
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:10523
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27925
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:214
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:21593
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3223
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4450
FactorDef * clone() const override
Return a copy of the current node.
Definition: all.hpp:18462
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29885
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26281
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3397
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2717
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22090
std::shared_ptr< Unit > unit1
TODO.
Definition: all.hpp:18198
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25146
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21143
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29200
bool is_threadsafe_var() const noexcept override
Check if the ast node is an instance of ast::ThreadsafeVar.
Definition: all.hpp:5389
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29873
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29279
void reset_local_var(LocalVarVector::const_iterator position, LocalVar *n)
Reset member to variables.
Definition: all.hpp:19287
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30882
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:236
void insert_global_var(GlobalVarVector::const_iterator position, NodeType &to, InputIterator first, InputIterator last)
Insert members to variables.
Definition: all.hpp:28454
std::shared_ptr< Expression > expr
TODO.
Definition: all.hpp:25056
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30064
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26773
type of ast::NeuronBlock
const ExpressionVector & get_arguments() const noexcept
Getter for member variable FunctionCall::arguments.
Definition: all.hpp:17097
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27735
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28838
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2516
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14333
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18506
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30209
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21657
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8573
std::shared_ptr< Identifier > name
Name of array variable.
Definition: all.hpp:2437
WhileStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:22555
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29043
Represents an argument to functions and procedures.
Definition: all.hpp:2908
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27279
type of ast::InitialBlock
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7338
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:6900
Useion * clone() const override
Return a copy of the current node.
Definition: all.hpp:27224
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24040
ReactionOperator op
TODO.
Definition: all.hpp:25759
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8222
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8781
std::vector< std::shared_ptr< Argument > > ArgumentVector
Definition: ast_decl.hpp:348
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7088
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:10561
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28321
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ForAllStatement::name.
Definition: all.hpp:22404
void emplace_back_node(std::shared_ptr< Node > n)
Add member to blocks by shared_ptr.
Definition: all.hpp:30333
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15413
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14952
std::vector< std::shared_ptr< LocalVar > > LocalVarVector
Definition: ast_decl.hpp:395
ArgumentVector parameters
Arguments to the for netcon block.
Definition: all.hpp:12164
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15579
void emplace_back_statement(std::shared_ptr< Statement > n)
Add member to statements by shared_ptr.
Definition: all.hpp:7893
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13082
bool is_stepped() const noexcept override
Check if the ast node is an instance of ast::Stepped.
Definition: all.hpp:20314
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12428
std::vector< std::shared_ptr< GlobalVar > > GlobalVarVector
Definition: ast_decl.hpp:356
const NumberVector & get_values() const noexcept
Getter for member variable Stepped::values.
Definition: all.hpp:20392
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4004
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6558
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9295
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable LonDifuse::name.
Definition: all.hpp:25631
bool is_electrode_cur_var() const noexcept override
Check if the ast node is an instance of ast::ElectrodeCurVar.
Definition: all.hpp:3977
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25767
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15971
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7026
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15550
ExternVarVector variables
Vector of external variables.
Definition: all.hpp:28997
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:25598
type of ast::FromStatement
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29858
bool is_linear_block() const noexcept override
Check if the ast node is an instance of ast::LinearBlock.
Definition: all.hpp:8423
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable InitialBlock::statement_block.
Definition: all.hpp:7147
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22097
std::shared_ptr< Identifier > name
Name of the argument.
Definition: all.hpp:2911
QueueType
enum type for queue types
Definition: ast_common.hpp:86
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20594
type of ast::NonspecificCurVar
double get_value() const noexcept
Getter for member variable Double::value.
Definition: all.hpp:1641
const std::shared_ptr< Expression > & get_react() const noexcept
Getter for member variable Conserve::react.
Definition: all.hpp:25165
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:15695
type of ast::FunctionBlock
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4630
bool is_procedure_block() const noexcept override
Check if the ast node is an instance of ast::ProcedureBlock.
Definition: all.hpp:10136
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:10574
const std::string & get_value() const noexcept
Getter for member variable String::value.
Definition: all.hpp:966
const WatchVector & get_statements() const noexcept
Getter for member variable WatchStatement::statements.
Definition: all.hpp:24254
std::shared_ptr< Number > start
TODO.
Definition: all.hpp:20520
MatchBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12740
const std::shared_ptr< Unit > & get_unit2() const noexcept
Getter for member variable UnitDef::unit2.
Definition: all.hpp:18312
WriteIonVarVector writelist
Variables being written.
Definition: all.hpp:27182
const std::shared_ptr< FirstLastTypeIndex > & get_index() const noexcept
Getter for member variable PartialBoundary::index.
Definition: all.hpp:23838
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19518
std::vector< std::shared_ptr< Match > > MatchVector
Definition: ast_decl.hpp:415
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ProcedureBlock::statement_block.
Definition: all.hpp:10267
PlotVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:14708
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9886
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19833
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3419
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13860
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11757
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3209
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23245
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2258
FirstLastType get_value() const noexcept
Getter for member variable FirstLastTypeIndex::value.
Definition: all.hpp:17298
std::shared_ptr< Unit > unit2
TODO.
Definition: all.hpp:18200
void reset_node(NodeVector::const_iterator position, Node *n)
Reset member to blocks.
Definition: all.hpp:30411
NodeVector::const_iterator insert_node(NodeVector::const_iterator position, const std::shared_ptr< Node > &n)
Insert member to blocks.
Definition: all.hpp:30384
LineComment * clone() const override
Return a copy of the current node.
Definition: all.hpp:29637
VarNameVector variables
TODO.
Definition: all.hpp:24856
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2301
Represents a float variable.
Definition: all.hpp:1318
ParamAssignVector statements
Vector of parameters.
Definition: all.hpp:5585
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28192
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16847
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24589
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:5369
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20916
bool is_nonspecific_cur_var() const noexcept override
Check if the ast node is an instance of ast::NonspecificCurVar.
Definition: all.hpp:3772
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2053
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24419
void emplace_back_global_var(std::shared_ptr< GlobalVar > n)
Add member to variables by shared_ptr.
Definition: all.hpp:28390
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28277
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14313
Verbatim * clone() const override
Return a copy of the current node.
Definition: all.hpp:29433
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13294
type of ast::Conserve
const std::shared_ptr< Number > & get_from() const noexcept
Getter for member variable IndependentDefinition::from.
Definition: all.hpp:20638
FirstLastTypeIndex * clone() const override
Return a copy of the current node.
Definition: all.hpp:17232
const std::shared_ptr< Name > & get_name2() const noexcept
Getter for member variable PartialEquation::name2.
Definition: all.hpp:23565
bool is_section() const noexcept override
Check if the ast node is an instance of ast::Section.
Definition: all.hpp:27898
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28632
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30889
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13069
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4762
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:940
Represent linear solver solution block based on Eigen.
Definition: all.hpp:31150
bool is_verbatim() const noexcept override
Check if the ast node is an instance of ast::Verbatim.
Definition: all.hpp:29421
RangeVarVector variables
Vector of range variables.
Definition: all.hpp:28077
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26567
LocalVarVector variables
TODO.
Definition: all.hpp:19086
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4429
std::shared_ptr< Number > min
TODO.
Definition: all.hpp:14467
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13179
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16180
std::vector< std::shared_ptr< VarName > > VarNameVector
Definition: ast_decl.hpp:347
std::shared_ptr< PlotVar > name
TODO.
Definition: all.hpp:21141
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26693
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17510
const LocalVarVector & get_variables() const noexcept
Getter for member variable LocalListStatement::variables.
Definition: all.hpp:19308
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24455
NodeVector::const_iterator erase_node(NodeVector::const_iterator first)
Erase member to blocks.
Definition: all.hpp:30342
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FunctionTableBlock::name.
Definition: all.hpp:9656
std::shared_ptr< Identifier > name
Name of variable.
Definition: all.hpp:2664
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20175
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13472
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9071
const std::shared_ptr< Unit > & get_unit1() const noexcept
Getter for member variable FactorDef::unit1.
Definition: all.hpp:18548
bool is_constructor_block() const noexcept override
Check if the ast node is an instance of ast::ConstructorBlock.
Definition: all.hpp:7294
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21418
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19691
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17249
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25605
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17308
Global * clone() const override
Return a copy of the current node.
Definition: all.hpp:28306
std::shared_ptr< Expression > lhs
LHS of the binary expression.
Definition: all.hpp:15900
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21686
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19503
const PointerVarVector & get_variables() const noexcept
Getter for member variable Pointer::variables.
Definition: all.hpp:28691
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29259
bool is_if_statement() const noexcept override
Check if the ast node is an instance of ast::IfStatement.
Definition: all.hpp:22777
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:23321
const std::shared_ptr< Expression > & get_to() const noexcept
Getter for member variable TableStatement::to.
Definition: all.hpp:26819
std::vector< std::shared_ptr< ReadIonVar > > ReadIonVarVector
Definition: ast_decl.hpp:350
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6200
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:19164
type of ast::MutexUnlock
std::shared_ptr< Expression > value
TODO.
Definition: all.hpp:17397
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3816
int value
Value of integer.
Definition: all.hpp:1082
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4608
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:6459
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16396
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14883
Represents an integer variable.
Definition: all.hpp:1079
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:10536
bool is_function_block() const noexcept override
Check if the ast node is an instance of ast::FunctionBlock.
Definition: all.hpp:9829
type of ast::IndexedName
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:12426
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28794
ExpressionVector definitions
Vector of unit statements.
Definition: all.hpp:12935
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31579
BinaryOp get_value() const noexcept
Getter for member variable BinaryOperator::value.
Definition: all.hpp:15210
const std::shared_ptr< Expression > & get_left_linxpression() const noexcept
Getter for member variable LinEquation::left_linxpression.
Definition: all.hpp:16866
std::vector< std::shared_ptr< PlotVar > > PlotVarVector
Definition: ast_decl.hpp:398
std::shared_ptr< Identifier > name
Name of the variable (TODO)
Definition: all.hpp:26057
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27345
PlotBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:6829
Represents a DESTRUCTOR block in the NMODL.
Definition: all.hpp:7522
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FromStatement::name.
Definition: all.hpp:22129
ParamAssign * clone() const override
Return a copy of the current node.
Definition: all.hpp:20074
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8005
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4852
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14328
const std::shared_ptr< Name > & get_name1() const noexcept
Getter for member variable PartialBoundary::name1.
Definition: all.hpp:23852
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24783
Represent SENS statement in NMODL.
Definition: all.hpp:24853
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:10232
const std::shared_ptr< BABlock > & get_bablock() const noexcept
Getter for member variable AfterBlock::bablock.
Definition: all.hpp:11816
const std::shared_ptr< String > & get_value() const noexcept
Getter for member variable PrimeName::value.
Definition: all.hpp:2319
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7527
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3627
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19134
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17666
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13921
type of ast::BbcorePointerVar
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11058
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8492
void emplace_back_local_var(LocalVar *n)
Add member to variables by raw pointer.
Definition: all.hpp:19196
virtual Statement * clone() const override
Return a copy of the current node.
Definition: all.hpp:199
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20909
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable PartialBlock::statement_block.
Definition: all.hpp:9387
std::shared_ptr< String > ontology_id
Ontology name.
Definition: all.hpp:30000
bool is_statement() const noexcept override
Check if the ast node is an instance of ast::Statement.
Definition: all.hpp:187
bool is_wrapped_expression() const noexcept override
Check if the ast node is an instance of ast::WrappedExpression.
Definition: all.hpp:31535
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24594
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19705
bool is_nonspecific() const noexcept override
Check if the ast node is an instance of ast::Nonspecific.
Definition: all.hpp:27488
bool is_constant_var() const noexcept override
Check if the ast node is an instance of ast::ConstantVar.
Definition: all.hpp:14903
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28882
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18963
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21851
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14152
void reset_watch(WatchVector::const_iterator position, std::shared_ptr< Watch > n)
Reset member to statements.
Definition: all.hpp:24243
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24119
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7412
std::shared_ptr< Unit > unit
Unit of the argument.
Definition: all.hpp:2913
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20931
const std::shared_ptr< QueueExpressionType > & get_qtype() const noexcept
Getter for member variable QueueStatement::qtype.
Definition: all.hpp:26375
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:22520
bool is_function_call() const noexcept override
Check if the ast node is an instance of ast::FunctionCall.
Definition: all.hpp:17004
std::shared_ptr< Expression > expression2
TODO.
Definition: all.hpp:25765
UnitState * clone() const override
Return a copy of the current node.
Definition: all.hpp:18926
ConstantStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:26521
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:17395
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18075
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9891
const std::shared_ptr< Integer > & get_value() const noexcept
Getter for member variable Define::value.
Definition: all.hpp:19728
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:10465
const BbcorePointerVarVector & get_variables() const noexcept
Getter for member variable BbcorePointer::variables.
Definition: all.hpp:28901
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26142
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:520
bool is_discrete_block() const noexcept override
Check if the ast node is an instance of ast::DiscreteBlock.
Definition: all.hpp:9002
bool is_bbcore_pointer() const noexcept override
Check if the ast node is an instance of ast::BbcorePointer.
Definition: all.hpp:28811
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18568
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30274
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5633
bool is_section_var() const noexcept override
Check if the ast node is an instance of ast::SectionVar.
Definition: all.hpp:4179
UnaryOperator op
TODO.
Definition: all.hpp:16324
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13260
Type to represent different block types for before/after block.
Definition: all.hpp:18004
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11319
NeuronBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:13457
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21836
std::vector< std::shared_ptr< BbcorePointerVar > > BbcorePointerVarVector
Definition: ast_decl.hpp:358
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31802
bool is_model() const noexcept override
Check if the ast node is an instance of ast::Model.
Definition: all.hpp:19422
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30616
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:14673
type of ast::Expression
const std::shared_ptr< String > & get_statement() const noexcept
Getter for member variable Verbatim::statement.
Definition: all.hpp:29509
std::shared_ptr< Integer > length
Length in case of array.
Definition: all.hpp:20820
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1323
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2976
type of ast::ElctrodeCurrent
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1811
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Useion::name.
Definition: all.hpp:27311
Sens * clone() const override
Return a copy of the current node.
Definition: all.hpp:24887
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11293
std::shared_ptr< StatementBlock > finalize_block
Statement block to be executed after calling linear solver.
Definition: all.hpp:31163
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable PointerVar::name.
Definition: all.hpp:4870
const std::shared_ptr< Double > & get_max() const noexcept
Getter for member variable Limits::max.
Definition: all.hpp:14364
Represents the coreneuron nrn_state callback function.
Definition: all.hpp:30535
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ForAllStatement::statement_block.
Definition: all.hpp:22409
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:654
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28079
std::shared_ptr< String > filename
TODO.
Definition: all.hpp:19831
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17888
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable VarName::name.
Definition: all.hpp:2776
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21789
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29674
bool is_range() const noexcept override
Check if the ast node is an instance of ast::Range.
Definition: all.hpp:28096
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16202
Represents a name.
Definition: all.hpp:1981
Represents a prime variable (for ODE)
Definition: all.hpp:2203
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22897
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17465
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24099
AfterBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11727
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29652
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:12785
MutexUnlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:24544
NameVector solvefor
Name of the integration method.
Definition: all.hpp:8692
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23066
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:11215
BinaryOperator op
Operator.
Definition: all.hpp:15902
std::shared_ptr< Expression > expression1
TODO.
Definition: all.hpp:25763
type of ast::ProcedureBlock
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29463
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:6429
Represents BBCOREPOINTER statement in NMODL.
Definition: all.hpp:28789
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10678
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:10729
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18768
type of ast::NumberRange
type of ast::BbcorePointer
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21595
const std::shared_ptr< Expression > & get_index() const noexcept
Getter for member variable VarName::index.
Definition: all.hpp:2786
float value
Value of float.
Definition: all.hpp:1321
bool is_define() const noexcept override
Check if the ast node is an instance of ast::Define.
Definition: all.hpp:19624
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19318
std::shared_ptr< String > title
TODO.
Definition: all.hpp:19402
bool is_compartment() const noexcept override
Check if the ast node is an instance of ast::Compartment.
Definition: all.hpp:25301
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:13423
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18970
const ExternVarVector & get_variables() const noexcept
Getter for member variable External::variables.
Definition: all.hpp:29104
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23823
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29483
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21871
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1387
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9337
type of ast::ThreadsafeVar
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5244
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17867
std::shared_ptr< Double > value
TODO.
Definition: all.hpp:18417
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7425
ArgumentVector parameters
Parameters to the net receive block.
Definition: all.hpp:10411
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7367
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable PartialBoundary::name.
Definition: all.hpp:23833
int value
Value of boolean.
Definition: all.hpp:1765
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14539
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28177
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31956
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24793
Reset * clone() const override
Return a copy of the current node.
Definition: all.hpp:24714
const AssignedDefinitionVector & get_definitions() const noexcept
Getter for member variable StateBlock::definitions.
Definition: all.hpp:6678
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7776
std::shared_ptr< Expression > reaction2
TODO.
Definition: all.hpp:25761
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26599
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3613
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27750
const WriteIonVarVector & get_writelist() const noexcept
Getter for member variable Useion::writelist.
Definition: all.hpp:27321
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable FunctionTableBlock::unit.
Definition: all.hpp:9668
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24518
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:10744
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16885
Represents differential equation in DERIVATIVE block.
Definition: all.hpp:16127
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31225
virtual void set_parent(Ast *p)
Parent setter.
Definition: ast.cpp:345
Integer * clone() const override
Return a copy of the current node.
Definition: all.hpp:1118
type of ast::QueueStatement
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3845
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30860
WatchVector::const_iterator erase_watch(WatchVector::const_iterator first, WatchVector::const_iterator last)
Erase members to statements.
Definition: all.hpp:24171
void emplace_back_watch(Watch *n)
Add member to statements by raw pointer.
Definition: all.hpp:24145
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable AssignedDefinition::unit.
Definition: all.hpp:20974
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26758
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable FromStatement::statement_block.
Definition: all.hpp:22151
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9310
SectionVarVector sections
Vector of section variables.
Definition: all.hpp:27879
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17486
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable PartialBoundary::expression.
Definition: all.hpp:23845
const std::shared_ptr< Number > & get_start() const noexcept
Getter for member variable IndependentDefinition::start.
Definition: all.hpp:20653
type of ast::UnaryExpression
bool is_protect_statement() const noexcept override
Check if the ast node is an instance of ast::ProtectStatement.
Definition: all.hpp:21807
DoubleUnit * clone() const override
Return a copy of the current node.
Definition: all.hpp:13891
type of ast::QueueExpressionType
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:12508
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:6673
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17399
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5459
const std::shared_ptr< Name > & get_byname() const noexcept
Getter for member variable LagStatement::byname.
Definition: all.hpp:26173
type of ast::WhileStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7662
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ThreadsafeVar::name.
Definition: all.hpp:5477
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27778
BbcorePointer * clone() const override
Return a copy of the current node.
Definition: all.hpp:28823
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11784
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:947
bool is_match() const noexcept override
Check if the ast node is an instance of ast::Match.
Definition: all.hpp:17820
bool is_eigen_newton_solver_block() const noexcept override
Check if the ast node is an instance of ast::EigenNewtonSolverBlock.
Definition: all.hpp:30816
Represent LONGITUDINAL_DIFFUSION statement in NMODL.
Definition: all.hpp:25512
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23522
std::vector< std::shared_ptr< IndependentDefinition > > IndependentDefinitionVector
Definition: ast_decl.hpp:429
bool is_unit() const noexcept override
Check if the ast node is an instance of ast::Unit.
Definition: all.hpp:13677
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16439
NodeVector::const_iterator erase_node(NodeVector::const_iterator first, NodeVector::const_iterator last)
Erase members to blocks.
Definition: all.hpp:30349
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27559
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:5971
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8166
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29667
type of ast::PartialEquation
ElseIfStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:23051
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29286
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27994
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3134
const std::shared_ptr< PrimeName > & get_prime() const noexcept
Getter for member variable PartialEquation::prime.
Definition: all.hpp:23555
Stepped * clone() const override
Return a copy of the current node.
Definition: all.hpp:20326
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13906
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9059
NameVector depend_vars
dependent variables
Definition: all.hpp:26685
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27795
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:10280
const std::shared_ptr< Valence > & get_valence() const noexcept
Getter for member variable Useion::valence.
Definition: all.hpp:27326
Represents a boolean variable.
Definition: all.hpp:1762
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25328
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7675
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8815
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31608
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14471
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27031
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4637
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18956
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18499
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12513
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12755
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17046
bool is_terminal_block() const noexcept override
Check if the ast node is an instance of ast::TerminalBlock.
Definition: all.hpp:11236
QueueType get_value() const noexcept
Getter for member variable QueueExpressionType::value.
Definition: all.hpp:17700
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2530
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:6213
std::shared_ptr< VarName > name
TODO.
Definition: all.hpp:3132
type of ast::Compartment
LagStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:26092
BABlockType * clone() const override
Return a copy of the current node.
Definition: all.hpp:18038
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19666
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:11213
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7837
std::shared_ptr< Name > del2
TODO.
Definition: all.hpp:23707
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23101
AssignedDefinitionVector definitions
Vector of assigned variables.
Definition: all.hpp:6312
type of ast::LagStatement
WatchVector::const_iterator erase_watch(WatchVector::const_iterator first)
Erase member to statements.
Definition: all.hpp:24164
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30642
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable FactorDef::value.
Definition: all.hpp:18543
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18068
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19684
bool is_sens() const noexcept override
Check if the ast node is an instance of ast::Sens.
Definition: all.hpp:24875
const std::shared_ptr< Integer > & get_order() const noexcept
Getter for member variable PrimeName::order.
Definition: all.hpp:2324
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29521
NonspecificCurVarVector currents
Vector of non specific variables.
Definition: all.hpp:27469
NameVector names
TODO.
Definition: all.hpp:25519
Section * clone() const override
Return a copy of the current node.
Definition: all.hpp:27910
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25384
bool is_external() const noexcept override
Check if the ast node is an instance of ast::External.
Definition: all.hpp:29016
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26061
ThreadSafe * clone() const override
Return a copy of the current node.
Definition: all.hpp:29229
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21372
type of ast::Identifier
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8208
LocalVarVector::const_iterator erase_local_var(LocalVarVector::const_iterator first, LocalVarVector::const_iterator last)
Erase members to variables.
Definition: all.hpp:19224
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:5663
type of ast::PlotDeclaration
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27573
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:5904
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22804
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15309
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15355
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1610
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:31297
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3426
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22839
const std::shared_ptr< PlotVar > & get_name() const noexcept
Getter for member variable PlotDeclaration::name.
Definition: all.hpp:21255
type of ast::SectionVar
GlobalVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4593
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11553
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ExternVar::name.
Definition: all.hpp:5276
bool is_float() const noexcept override
Check if the ast node is an instance of ast::Float.
Definition: all.hpp:1340
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:5943
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29058
const NameVector & get_solvefor() const noexcept
Getter for member variable NonLinearBlock::solvefor.
Definition: all.hpp:8838
bool is_unit_block() const noexcept override
Check if the ast node is an instance of ast::UnitBlock.
Definition: all.hpp:12956
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24729
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22570
Represents CONDUCTANCE statement in NMODL.
Definition: all.hpp:21365
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27011
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15999
bool is_pointer_var() const noexcept override
Check if the ast node is an instance of ast::PointerVar.
Definition: all.hpp:4782
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:23243
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17460
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1160
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9064
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3553
bool is_plot_var() const noexcept override
Check if the ast node is an instance of ast::PlotVar.
Definition: all.hpp:14696
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17605
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:10847
virtual Expression * clone() const override
Return a copy of the current node.
Definition: all.hpp:334
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:18415
WriteIonVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:3583
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24625
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30049
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13559
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2565
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8560
type of ast::ParenExpression
std::shared_ptr< Number > to
TODO.
Definition: all.hpp:20824
const std::shared_ptr< Expression > & get_linxpression() const noexcept
Getter for member variable LinEquation::linxpression.
Definition: all.hpp:16873
std::shared_ptr< Double > value
TODO.
Definition: all.hpp:13856
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26778
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25139
StepBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:5859
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13018
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ElectrodeCurVar::name.
Definition: all.hpp:4065
const ConstantStatementVector & get_statements() const noexcept
Getter for member variable ConstantBlock::statements.
Definition: all.hpp:13299
SolveBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:10714
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15978
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15502
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8284
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18984
PlotDeclaration * clone() const override
Return a copy of the current node.
Definition: all.hpp:21174
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13528
PrimeName * clone() const override
Return a copy of the current node.
Definition: all.hpp:2243
ElectrodeCurVarVector currents
Vector of electrode current variables.
Definition: all.hpp:27674
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15697
DestructorBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7560
Name * clone() const override
Return a copy of the current node.
Definition: all.hpp:2018
const std::shared_ptr< ConstantVar > & get_constant() const noexcept
Getter for member variable ConstantStatement::constant.
Definition: all.hpp:26587
Represent NEURON block in the mod file.
Definition: all.hpp:13420
std::shared_ptr< Name > conductance
Conductance variable.
Definition: all.hpp:21368
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:22749
PointerVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4794
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:19679
std::shared_ptr< String > ontology_id
Ontology to indicate the chemical ion.
Definition: all.hpp:27186
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:935
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7108
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13311
std::shared_ptr< Name > name3
TODO.
Definition: all.hpp:23456
std::shared_ptr< Identifier > name
Name of the variable.
Definition: all.hpp:20818
bool is_solve_block() const noexcept override
Check if the ast node is an instance of ast::SolveBlock.
Definition: all.hpp:10702
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5230
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18322
NameVector solvefor
Solve for specification (TODO)
Definition: all.hpp:12424
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:1711
bool is_var_name() const noexcept override
Check if the ast node is an instance of ast::VarName.
Definition: all.hpp:2690
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6873
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3195
const StatementVector & get_statements() const noexcept
Getter for member variable StatementBlock::statements.
Definition: all.hpp:7995
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:31255
bool is_net_receive_block() const noexcept override
Check if the ast node is an instance of ast::NetReceiveBlock.
Definition: all.hpp:10438
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26370
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17710
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7590
void reset_node(NodeVector::const_iterator position, std::shared_ptr< Node > n)
Reset member to blocks.
Definition: all.hpp:30421
std::shared_ptr< Name > name1
TODO.
Definition: all.hpp:23452
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6156
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26163
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20361
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20832
void negate() override
Negate the value of current ast node.
Definition: all.hpp:1478
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12313
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4277
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2287
const std::shared_ptr< SolveBlock > & get_solve_block() const noexcept
Getter for member variable SolutionExpression::solve_block.
Definition: all.hpp:32005
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ProcedureBlock::name.
Definition: all.hpp:10250
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24348
const std::shared_ptr< Number > & get_max() const noexcept
Getter for member variable NumberRange::max.
Definition: all.hpp:14570
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22860
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6639
GlobalVarVector variables
Vector of global variables.
Definition: all.hpp:28275
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27881
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:6142
Base class for all block scoped nodes.
Definition: all.hpp:441
const std::shared_ptr< StatementBlock > & get_initialize_block() const noexcept
Getter for member variable EigenLinearSolverBlock::initialize_block.
Definition: all.hpp:31318
std::shared_ptr< Expression > node_to_solve
Block to be solved (callback node or solution node itself)
Definition: all.hpp:31905
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:20292
bool is_write_ion_var() const noexcept override
Check if the ast node is an instance of ast::WriteIonVar.
Definition: all.hpp:3571
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11097
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24971
bool is_include() const noexcept override
Check if the ast node is an instance of ast::Include.
Definition: all.hpp:19851
std::shared_ptr< Integer > index
TODO.
Definition: all.hpp:14675
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14340
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable NetReceiveBlock::statement_block.
Definition: all.hpp:10548
type of ast::DerivimplicitCallback
type of ast::TableStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6690
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25182
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10771
type of ast::NonLinEquation
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21476
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26553
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2915
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable LinearBlock::statement_block.
Definition: all.hpp:8547
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2502
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4159
PartialBoundary * clone() const override
Return a copy of the current node.
Definition: all.hpp:23752
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17472
std::vector< std::shared_ptr< NonspecificCurVar > > NonspecificCurVarVector
Definition: ast_decl.hpp:352
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2487
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9566
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:9805
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:874
bool is_indexed_name() const noexcept override
Check if the ast node is an instance of ast::IndexedName.
Definition: all.hpp:2460
ForNetcon * clone() const override
Return a copy of the current node.
Definition: all.hpp:12202
bool is_mutex_unlock() const noexcept override
Check if the ast node is an instance of ast::MutexUnlock.
Definition: all.hpp:24532
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4561
std::vector< std::shared_ptr< ElectrodeCurVar > > ElectrodeCurVarVector
Definition: ast_decl.hpp:353
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22055
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18275
type of ast::DestructorBlock
virtual std::string get_node_name() const
Return name of of the node.
Definition: ast.cpp:29
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9044
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable KineticBlock::statement_block.
Definition: all.hpp:12575
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable QueueStatement::name.
Definition: all.hpp:26382
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11532
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25160
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1174
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6395
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18741
BAType value
block type
Definition: all.hpp:18007
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10205
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12478
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27720
type of ast::AssignedBlock
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable ProcedureBlock::unit.
Definition: all.hpp:10262
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:7271
size_t erase_node(std::unordered_set< Node *> &to_be_erased)
Erase non-consecutive members to blocks.
Definition: all.hpp:30360
bool is_diff_eq_expression() const noexcept override
Check if the ast node is an instance of ast::DiffEqExpression.
Definition: all.hpp:16151
const std::shared_ptr< Expression > & get_from() const noexcept
Getter for member variable FromStatement::from.
Definition: all.hpp:22134
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11043
std::shared_ptr< Name > type
TODO.
Definition: all.hpp:18691
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1408
FromStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:22040
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5689
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:28868
Program * clone() const override
Return a copy of the current node.
Definition: all.hpp:30244
const std::shared_ptr< String > & get_ontology_id() const noexcept
Getter for member variable OntologyStatement::ontology_id.
Definition: all.hpp:30111
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3440
type of ast::ConstructorBlock
const NameVector & get_table_vars() const noexcept
Getter for member variable TableStatement::table_vars.
Definition: all.hpp:26804
const MatchVector & get_matchs() const noexcept
Getter for member variable MatchBlock::matchs.
Definition: all.hpp:12829
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1549
std::string eval() const
Return enum value in string form.
Definition: all.hpp:17759
const std::shared_ptr< StatementBlock > & get_initialize_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::initialize_block.
Definition: all.hpp:30938
const NodeVector & get_blocks() const noexcept
Getter for member variable Program::blocks.
Definition: all.hpp:30432
StatementVector statements
Vector of statements.
Definition: all.hpp:7774
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27552
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12288
RangeVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4392
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13502
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21462
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8181
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14124
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Suffix::name.
Definition: all.hpp:27075
BbcorePointerVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4996
std::shared_ptr< Name > name2
TODO.
Definition: all.hpp:23454
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31165
AssignedBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:6345
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11070
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11028
type of ast::BinaryExpression
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8271
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31625
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11583
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29490
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12811
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15757
std::shared_ptr< Integer > with
TODO.
Definition: all.hpp:20518
bool is_ba_block_type() const noexcept override
Check if the ast node is an instance of ast::BABlockType.
Definition: all.hpp:18026
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16024
ReactVarName * clone() const override
Return a copy of the current node.
Definition: all.hpp:3165
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable RangeVar::name.
Definition: all.hpp:4468
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4075
type of ast::BinaryOperator
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:6183
Argument * clone() const override
Return a copy of the current node.
Definition: all.hpp:2946
MatchVector matchs
Vector of match statements.
Definition: all.hpp:12707
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1423
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable ExpressionStatement::expression.
Definition: all.hpp:21691
type of ast::ThreadSafe
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable IndexedName::name.
Definition: all.hpp:2548
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15377
const std::shared_ptr< Integer > & get_at() const noexcept
Getter for member variable VarName::at.
Definition: all.hpp:2781
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25411
ParenExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:15727
Auto generated AST classes declaration.
std::shared_ptr< Name > method
Name of the integration method.
Definition: all.hpp:10672
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19932
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26491
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25835
type of ast::NetReceiveBlock
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6416
bool is_conductance_hint() const noexcept override
Check if the ast node is an instance of ast::ConductanceHint.
Definition: all.hpp:21391
Base class for all AST node.
Definition: all.hpp:43
TerminalBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11248
FunctionBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9841
virtual ~Node()=default
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20407
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8117
std::shared_ptr< ElseStatement > elses
TODO.
Definition: all.hpp:22753
Base class for all numbers.
Definition: all.hpp:716
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24574
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:30313
bool is_breakpoint_block() const noexcept override
Check if the ast node is an instance of ast::BreakpointBlock.
Definition: all.hpp:11001
SteppedVector statements
Vector of statements.
Definition: all.hpp:5826
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable DoubleUnit::value.
Definition: all.hpp:13954
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13039
std::shared_ptr< Valence > valence
(TODO)
Definition: all.hpp:27184
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9871
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25343
bool is_param_block() const noexcept override
Check if the ast node is an instance of ast::ParamBlock.
Definition: all.hpp:5606
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:10785
BlockComment * clone() const override
Return a copy of the current node.
Definition: all.hpp:29828
bool eval() const
Return value of the ast node.
Definition: all.hpp:1938
IndependentDefinitionVector definitions
TODO.
Definition: all.hpp:6062
std::shared_ptr< Name > macro
if integer is a macro then it&#39;s name
Definition: all.hpp:1084
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:20036
bool is_unit_def() const noexcept override
Check if the ast node is an instance of ast::UnitDef.
Definition: all.hpp:18221
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30286
type of ast::SolveBlock
bool is_watch_statement() const noexcept override
Check if the ast node is an instance of ast::WatchStatement.
Definition: all.hpp:24057
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24757
ConstantStatementVector statements
Vector of constant statements.
Definition: all.hpp:13177
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7610
type of ast::StatementBlock
std::vector< std::shared_ptr< Watch > > WatchVector
Definition: ast_decl.hpp:412
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9325
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8201
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13724
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26149
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11596
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4161
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2744
Represents NONLINEAR block in the NMODL.
Definition: all.hpp:8687
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29317
KineticBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12463
std::string eval() const
Return enum value in string form.
Definition: all.hpp:15657
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23458
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16640
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14109
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable FunctionBlock::unit.
Definition: all.hpp:9955
BeforeBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11482
const NameVector & get_solvefor() const noexcept
Getter for member variable KineticBlock::solvefor.
Definition: all.hpp:12570
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23306
ReactionStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:25803
size_t erase_watch(std::unordered_set< Watch *> &to_be_erased)
Erase non-consecutive members to statements.
Definition: all.hpp:24182
Represents a double variable.
Definition: all.hpp:1544
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable Watch::expression.
Definition: all.hpp:17491
StatementBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7807
EigenNewtonSolverBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:30828
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16417
bool is_unit_state() const noexcept override
Check if the ast node is an instance of ast::UnitState.
Definition: all.hpp:18914
std::shared_ptr< FirstLastTypeIndex > index
TODO.
Definition: all.hpp:23701
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25281
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable NonLinearBlock::statement_block.
Definition: all.hpp:8843
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6646
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18492
bool is_binary_expression() const noexcept override
Check if the ast node is an instance of ast::BinaryExpression.
Definition: all.hpp:15927
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24445
ParamBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:5618
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14764
StateBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:6589
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17847
std::shared_ptr< Unit > unit
Unit if specified.
Definition: all.hpp:9801
bool is_independent_block() const noexcept override
Check if the ast node is an instance of ast::IndependentBlock.
Definition: all.hpp:6083
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8235
void insert_node(NodeVector::const_iterator position, NodeType &to, InputIterator first, InputIterator last)
Insert members to blocks.
Definition: all.hpp:30394
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7073
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4679
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15398
bool is_local_var() const noexcept override
Check if the ast node is an instance of ast::LocalVar.
Definition: all.hpp:14082
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29300
bool is_solution_expression() const noexcept override
Check if the ast node is an instance of ast::SolutionExpression.
Definition: all.hpp:31927
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25568
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1986
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13324
Represents NONSPECIFIC_CURRENT variables statement in NMODL.
Definition: all.hpp:27466
PointerVarVector variables
Vector of pointer variables.
Definition: all.hpp:28586
double eval() const
Return value of the ast node.
Definition: all.hpp:1722
BAType
enum type to distinguish BEFORE or AFTER blocks
Definition: ast_common.hpp:92
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14784
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4422
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30586
Represents a DEFINE statement in NMODL.
Definition: all.hpp:19598
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11363
Represents a STATE block in the NMODL.
Definition: all.hpp:6553
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27940
std::shared_ptr< Number > value
Value of the constant.
Definition: all.hpp:14879
static const std::string UnitStateTypeNames[]
string representation of ast::UnitStateType
Definition: ast_common.hpp:101
type of ast::EigenNewtonSolverBlock
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:10495
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30123
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2113
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5828
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12033
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5035
const std::shared_ptr< BABlockType > & get_type() const noexcept
Getter for member variable BABlock::type.
Definition: all.hpp:12038
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7129
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28336
const AssignedDefinitionVector & get_definitions() const noexcept
Getter for member variable AssignedBlock::definitions.
Definition: all.hpp:6434
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1867
type of ast::DiffEqExpression
type of ast::LineComment
const std::shared_ptr< Expression > & get_reaction1() const noexcept
Getter for member variable ReactionStatement::reaction1.
Definition: all.hpp:25882
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25626
bool is_factor_def() const noexcept override
Check if the ast node is an instance of ast::FactorDef.
Definition: all.hpp:18450
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:22600
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11084
WatchVector::const_iterator insert_watch(WatchVector::const_iterator position, const std::shared_ptr< Watch > &n)
Insert member to statements.
Definition: all.hpp:24206
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27471
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1595
bool is_from_statement() const noexcept override
Check if the ast node is an instance of ast::FromStatement.
Definition: all.hpp:22028
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18248
std::shared_ptr< Double > abstol
TODO.
Definition: all.hpp:20830
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13949
std::vector< std::shared_ptr< Expression > > ExpressionVector
Definition: ast_decl.hpp:335
bool is_valence() const noexcept override
Check if the ast node is an instance of ast::Valence.
Definition: all.hpp:18714
std::shared_ptr< Name > ion
Ion name.
Definition: all.hpp:21370
std::vector< std::shared_ptr< Stepped > > SteppedVector
Definition: ast_decl.hpp:427
bool is_local_list_statement() const noexcept override
Check if the ast node is an instance of ast::LocalListStatement.
Definition: all.hpp:19105
std::shared_ptr< Name > name
Name of the function.
Definition: all.hpp:9797
std::shared_ptr< Name > del
TODO.
Definition: all.hpp:23697
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19878
std::shared_ptr< Limits > limit
TODO.
Definition: all.hpp:20038
Represents THREADSAFE statement in NMODL.
Definition: all.hpp:29195
NetReceiveBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:10450
ElctrodeCurrent * clone() const override
Return a copy of the current node.
Definition: all.hpp:27705
bool is_derivative_block() const noexcept override
Check if the ast node is an instance of ast::DerivativeBlock.
Definition: all.hpp:8139
std::shared_ptr< Number > max
TODO.
Definition: all.hpp:14469
bool is_node() const noexcept override
Check if the ast node is an instance of ast::Node.
Definition: all.hpp:57
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:9514
BbcorePointerVarVector variables
Vector of bbcore pointer variables.
Definition: all.hpp:28792
ExpressionVector arguments
TODO.
Definition: all.hpp:16983
bool is_step_block() const noexcept override
Check if the ast node is an instance of ast::StepBlock.
Definition: all.hpp:5847
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1767
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:5168
void reset_global_var(GlobalVarVector::const_iterator position, std::shared_ptr< GlobalVar > n)
Reset member to variables.
Definition: all.hpp:28482
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26122
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19651
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:10978
bool is_string() const noexcept override
Check if the ast node is an instance of ast::String.
Definition: all.hpp:893
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21204
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:22001
const std::shared_ptr< Limits > & get_limit() const noexcept
Getter for member variable ParamAssign::limit.
Definition: all.hpp:20165
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6866
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20294
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:17799
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4831
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16403
std::shared_ptr< StatementBlock > setup_x_block
update X from states
Definition: all.hpp:31159
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20989
std::shared_ptr< Boolean > gt
Todo: Michael : rename variable gt as well.
Definition: all.hpp:18421
bool is_paren_expression() const noexcept override
Check if the ast node is an instance of ast::ParenExpression.
Definition: all.hpp:15715
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16759
Represents CURIE information in NMODL.
Definition: all.hpp:29997
bool is_after_block() const noexcept override
Check if the ast node is an instance of ast::AfterBlock.
Definition: all.hpp:11715
std::vector< std::shared_ptr< AssignedDefinition > > AssignedDefinitionVector
Definition: ast_decl.hpp:431
std::string eval() const
Return enum value in string form.
Definition: all.hpp:15462
ForAllStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:22328
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24956
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8485
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12998
const std::shared_ptr< Number > & get_to() const noexcept
Getter for member variable IndependentDefinition::to.
Definition: all.hpp:20643
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6360
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable IndependentDefinition::name.
Definition: all.hpp:20633
const std::shared_ptr< Expression > & get_from() const noexcept
Getter for member variable TableStatement::from.
Definition: all.hpp:26814
Represents a multi-line comment in NMODL.
Definition: all.hpp:29793
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:625
void reset_watch(WatchVector::const_iterator position, Watch *n)
Reset member to statements.
Definition: all.hpp:24233
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16328
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable NetReceiveBlock::parameters.
Definition: all.hpp:10541
const std::shared_ptr< Double > & get_abstol() const noexcept
Getter for member variable AssignedDefinition::abstol.
Definition: all.hpp:20979
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8400
const std::shared_ptr< Expression > & get_expression1() const noexcept
Getter for member variable ReactionStatement::expression1.
Definition: all.hpp:25901
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6619
std::shared_ptr< Name > name
Name of the kinetic block.
Definition: all.hpp:12422
std::shared_ptr< Expression > from
from value
Definition: all.hpp:26687
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5889
const std::shared_ptr< Name > & get_macro() const noexcept
Getter for member variable Integer::macro.
Definition: all.hpp:1184
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13969
std::vector< std::shared_ptr< SectionVar > > SectionVarVector
Definition: ast_decl.hpp:354
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8802
bool is_thread_safe() const noexcept override
Check if the ast node is an instance of ast::ThreadSafe.
Definition: all.hpp:29217
bool is_eigen_linear_solver_block() const noexcept override
Check if the ast node is an instance of ast::EigenLinearSolverBlock.
Definition: all.hpp:31196
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12770
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19918
const std::shared_ptr< Expression > & get_rhs() const noexcept
Getter for member variable NonLinEquation::rhs.
Definition: all.hpp:16650
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31971
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15384
bool is_table_statement() const noexcept override
Check if the ast node is an instance of ast::TableStatement.
Definition: all.hpp:26716
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6314
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15593
const std::shared_ptr< StatementBlock > & get_setup_x_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::setup_x_block.
Definition: all.hpp:30945
type of ast::AfterBlock
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable LocalVar::name.
Definition: all.hpp:14170
std::shared_ptr< Name > name
Name of the function table block.
Definition: all.hpp:9508
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24902
std::shared_ptr< Expression > index
index value in case of array
Definition: all.hpp:2668
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29244
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22585
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:1483
const ReactionOperator & get_op() const noexcept
Getter for member variable ReactionStatement::op.
Definition: all.hpp:25889
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7878
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17271
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable TerminalBlock::statement_block.
Definition: all.hpp:11337
std::shared_ptr< String > name
TODO.
Definition: all.hpp:13657
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:21219
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18695
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14945
bool is_else_statement() const noexcept override
Check if the ast node is an instance of ast::ElseStatement.
Definition: all.hpp:23264
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9638
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable LinearBlock::name.
Definition: all.hpp:8537
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29878
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27958
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3468
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1826
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16538
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13773
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Compartment::name.
Definition: all.hpp:25389
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12006
Conserve * clone() const override
Return a copy of the current node.
Definition: all.hpp:25089
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7360
ExternVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5200
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12493
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13025
std::shared_ptr< Identifier > name
Name of the variable.
Definition: all.hpp:26279
Base class for all identifiers.
Definition: all.hpp:584
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16619
UnitBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12968
ElseIfStatementVector elseifs
TODO.
Definition: all.hpp:22751
std::shared_ptr< Number > value
TODO.
Definition: all.hpp:20034
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18096
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18263
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29607
const std::shared_ptr< Block > & get_node_to_solve() const noexcept
Getter for member variable DerivimplicitCallback::node_to_solve.
Definition: all.hpp:31807
void insert_statement(StatementVector::const_iterator position, NodeType &to, InputIterator first, InputIterator last)
Insert members to statements.
Definition: all.hpp:7957
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7644
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11999
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14580
std::shared_ptr< Name > type
type of channel
Definition: all.hpp:26961
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28123
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18053
std::shared_ptr< StatementBlock > initialize_block
Statement block to be executed before calling linear solver.
Definition: all.hpp:31157
const std::shared_ptr< Expression > & get_node_to_solve() const noexcept
Getter for member variable SolutionExpression::node_to_solve.
Definition: all.hpp:32012
const std::shared_ptr< Name > & get_del() const noexcept
Getter for member variable PartialBoundary::del.
Definition: all.hpp:23828
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:781
bool is_reaction_statement() const noexcept override
Check if the ast node is an instance of ast::ReactionStatement.
Definition: all.hpp:25791
const std::shared_ptr< ElseStatement > & get_elses() const noexcept
Getter for member variable IfStatement::elses.
Definition: all.hpp:22885
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:6390
const std::shared_ptr< BinaryExpression > & get_expression() const noexcept
Getter for member variable DiffEqExpression::expression.
Definition: all.hpp:16228
bool is_prime_name() const noexcept override
Check if the ast node is an instance of ast::PrimeName.
Definition: all.hpp:2231
type of ast::Argument
std::string eval() const
Return value of the ast node.
Definition: all.hpp:1033
Represents block encapsulating list of statements.
Definition: all.hpp:7771
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable Compartment::expression.
Definition: all.hpp:25394
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14930
std::shared_ptr< Expression > linxpression
TODO.
Definition: all.hpp:16757
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13928
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13704
Represent RESET statement in NMODL.
Definition: all.hpp:24685
type of ast::IfStatement
type of ast::ParamAssign
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2334
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31262
type of ast::FunctionTableBlock
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6402
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15184
const std::shared_ptr< Name > & get_name3() const noexcept
Getter for member variable PartialBoundary::name3.
Definition: all.hpp:23867
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28163
bool is_suffix() const noexcept override
Check if the ast node is an instance of ast::Suffix.
Definition: all.hpp:26984
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5416
type of ast::TerminalBlock
NrnStateBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:30571
ProcedureBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:10148
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6375
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable BABlock::statement_block.
Definition: all.hpp:12043
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17053
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28672
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12232
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31586
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:25515
void emplace_back_local_var(std::shared_ptr< LocalVar > n)
Add member to variables by shared_ptr.
Definition: all.hpp:19206
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6127
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2798
size_t erase_global_var(std::unordered_set< GlobalVar *> &to_be_erased)
Erase non-consecutive members to variables.
Definition: all.hpp:28419
const std::shared_ptr< Name > & get_method() const noexcept
Getter for member variable SolveBlock::method.
Definition: all.hpp:10810
SolutionExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:31939
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8696
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5487
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25119
bool is_lon_difuse() const noexcept override
Check if the ast node is an instance of ast::LonDifuse.
Definition: all.hpp:25541
virtual void visit_children(visitor::Visitor &v) override
visit children i.e.
Definition: ast.cpp:351
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22358
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21498
type of ast::OntologyStatement
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23122
NumberRange * clone() const override
Return a copy of the current node.
Definition: all.hpp:14502
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:3752
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:11450
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:10834
bool is_plot_block() const noexcept override
Check if the ast node is an instance of ast::PlotBlock.
Definition: all.hpp:6817
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12275
MutexLock * clone() const override
Return a copy of the current node.
Definition: all.hpp:24374
type of ast::BlockComment
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13281
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29504
bool is_program() const noexcept override
Check if the ast node is an instance of ast::Program.
Definition: all.hpp:30232
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4249
const std::shared_ptr< Boolean > & get_sweep() const noexcept
Getter for member variable IndependentDefinition::sweep.
Definition: all.hpp:20628
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15370
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable WhileStatement::statement_block.
Definition: all.hpp:22638
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8746
std::shared_ptr< Expression > to
to values
Definition: all.hpp:26689
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21265
const ExpressionVector & get_definitions() const noexcept
Getter for member variable UnitBlock::definitions.
Definition: all.hpp:13057
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable SectionVar::name.
Definition: all.hpp:4267
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11128
const std::shared_ptr< Number > & get_start() const noexcept
Getter for member variable AssignedDefinition::start.
Definition: all.hpp:20969
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20132
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3352
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19482
std::shared_ptr< Unit > unit1
TODO.
Definition: all.hpp:18419
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable DerivativeBlock::name.
Definition: all.hpp:8253
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:25134
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26785
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:8694
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28156
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24431
type of ast::DerivativeBlock
bool is_read_ion_var() const noexcept override
Check if the ast node is an instance of ast::ReadIonVar.
Definition: all.hpp:3370
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:8978
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable GlobalVar::name.
Definition: all.hpp:4669
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11305
const std::shared_ptr< Expression > & get_lhs() const noexcept
Getter for member variable NonLinEquation::lhs.
Definition: all.hpp:16645
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28503
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20368
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:378
const BinaryOperator & get_op() const noexcept
Getter for member variable BinaryExpression::op.
Definition: all.hpp:16009
std::shared_ptr< Expression > condition
TODO.
Definition: all.hpp:22747
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2074
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable LonDifuse::expression.
Definition: all.hpp:25636
std::shared_ptr< BinaryExpression > expression
Differential Expression.
Definition: all.hpp:16130
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:9803
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28686
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9856
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:8398
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23877
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17107
ArgumentVector parameters
Vector of the parameters.
Definition: all.hpp:9510
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:20288
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17673
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9603
const NameVector & get_names() const noexcept
Getter for member variable LonDifuse::names.
Definition: all.hpp:25643
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9925
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26799
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14180
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7822
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27052
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9678
ReactionOp value
TODO.
Definition: all.hpp:15500
std::shared_ptr< Name > name
Name of ion.
Definition: all.hpp:27178
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17278
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18782
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29478
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23782
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15771
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:10798
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8465
type of ast::ReactionOperator
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12069
BinaryOp value
Operator.
Definition: all.hpp:15114
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5028
const std::shared_ptr< Expression > & get_expression2() const noexcept
Getter for member variable ReactionStatement::expression2.
Definition: all.hpp:25908
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28999
std::shared_ptr< Name > name3
TODO.
Definition: all.hpp:23711
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4436
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6170
bool is_state_block() const noexcept override
Check if the ast node is an instance of ast::StateBlock.
Definition: all.hpp:6577
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18477
Nonspecific * clone() const override
Return a copy of the current node.
Definition: all.hpp:27500
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21245
static const std::string QueueTypeNames[]
string representation of ast::QueueType
Definition: ast_common.hpp:89
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24688
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13745
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6887
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30783
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:7353
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable ProcedureBlock::parameters.
Definition: all.hpp:10255
std::shared_ptr< Integer > n_state_vars
number of state vars used in solve
Definition: all.hpp:31153
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1622
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13052
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7173
Represents EXTERNAL statement in NMODL.
Definition: all.hpp:28994
std::string eval() const
Return enum value in string form.
Definition: all.hpp:17357
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14546
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:9247
void emplace_back_statement(Statement *n)
Add member to statements by raw pointer.
Definition: all.hpp:7883
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12534
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6604
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable Stepped::unit.
Definition: all.hpp:20397
const std::shared_ptr< Expression > & get_condition() const noexcept
Getter for member variable WhileStatement::condition.
Definition: all.hpp:22631
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3620
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20601
const std::shared_ptr< Expression > & get_increment() const noexcept
Getter for member variable FromStatement::increment.
Definition: all.hpp:22144
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27188
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25612
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12852
static const std::string UnaryOpNames[]
string representation of ast::UnaryOp
Definition: ast_common.hpp:77
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7631
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14959
bool is_bbcore_pointer_var() const noexcept override
Check if the ast node is an instance of ast::BbcorePointerVar.
Definition: all.hpp:4984
std::shared_ptr< BABlock > bablock
Block to be called before.
Definition: all.hpp:11448
bool is_for_all_statement() const noexcept override
Check if the ast node is an instance of ast::ForAllStatement.
Definition: all.hpp:22316
Abstract base class for all visitors implementation.
Definition: visitor.hpp:39
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24858
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28647
type of ast::ElectrodeCurVar
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19169
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable ConstantVar::unit.
Definition: all.hpp:15001
std::shared_ptr< Name > name
Name of the variable.
Definition: all.hpp:14877
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:10293
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24404
BinaryOp
enum Type for binary operators in NMODL
Definition: ast_common.hpp:47
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19605
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31517
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24424
std::shared_ptr< Double > min
TODO.
Definition: all.hpp:14263
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:99
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:25358
virtual void set_name(const std::string &name)
Set name for the AST node.
Definition: ast.cpp:47
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:22292
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23018
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28913
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20579
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable WrappedExpression::expression.
Definition: all.hpp:31613
const std::shared_ptr< String > & get_statement() const noexcept
Getter for member variable BlockComment::statement.
Definition: all.hpp:29904
bool is_plot_declaration() const noexcept override
Check if the ast node is an instance of ast::PlotDeclaration.
Definition: all.hpp:21162
const ReadIonVarVector & get_readlist() const noexcept
Getter for member variable Useion::readlist.
Definition: all.hpp:27316
std::shared_ptr< StatementBlock > variable_block
Statements to be declared in the functor.
Definition: all.hpp:30771
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30904
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3669
type of ast::WatchStatement
const std::shared_ptr< BABlock > & get_bablock() const noexcept
Getter for member variable BeforeBlock::bablock.
Definition: all.hpp:11571
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30601
void insert_local_var(LocalVarVector::const_iterator position, NodeType &to, InputIterator first, InputIterator last)
Insert members to variables.
Definition: all.hpp:19270
const NameVector & get_names() const noexcept
Getter for member variable Compartment::names.
Definition: all.hpp:25401
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9413
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:22834
int get_value() const noexcept
Getter for member variable Integer::value.
Definition: all.hpp:1179
std::shared_ptr< Number > start
TODO.
Definition: all.hpp:20826
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14738
Represent COMPARTMENT statement in NMODL.
Definition: all.hpp:25272
bool is_statement_block() const noexcept override
Check if the ast node is an instance of ast::StatementBlock.
Definition: all.hpp:7795
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12254
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable ParamAssign::name.
Definition: all.hpp:20150
bool is_boolean() const noexcept override
Check if the ast node is an instance of ast::Boolean.
Definition: all.hpp:1784
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16584
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15985
Model * clone() const override
Return a copy of the current node.
Definition: all.hpp:19434
std::shared_ptr< Unit > unit2
TODO.
Definition: all.hpp:18423
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:22373
const std::shared_ptr< StatementBlock > & get_variable_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::variable_block.
Definition: all.hpp:30930
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22399
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25920
UnitStateType get_value() const noexcept
Getter for member variable UnitState::value.
Definition: all.hpp:18989
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30628
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23507
const std::shared_ptr< Expression > & get_rhs() const noexcept
Getter for member variable BinaryExpression::rhs.
Definition: all.hpp:16014
UnaryExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:16359
LonDifuse * clone() const override
Return a copy of the current node.
Definition: all.hpp:25553
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21433
std::string eval() const
Return enum value in string form.
Definition: all.hpp:15269
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FunctionBlock::name.
Definition: all.hpp:9943
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:16981
Represents a statement in ASSIGNED or STATE block.
Definition: all.hpp:20815
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29448
type of ast::IndependentDefinition
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18761
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22164
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5916
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:11929
static const std::string FirstLastTypeNames[]
string representation of ast::FirstLastType
Definition: ast_common.hpp:83
std::shared_ptr< BABlockType > type
Type of NMODL block.
Definition: all.hpp:11927
Unit * clone() const override
Return a copy of the current node.
Definition: all.hpp:13689
NameVector names
TODO.
Definition: all.hpp:25279
bool is_unary_expression() const noexcept override
Check if the ast node is an instance of ast::UnaryExpression.
Definition: all.hpp:16347
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:11931
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:113
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:20032
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8450
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6844
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:6634
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5056
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18009
PartialBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9280
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30300
Represents a variable in the ast::ConstantBlock.
Definition: all.hpp:14874
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25877
Suffix * clone() const override
Return a copy of the current node.
Definition: all.hpp:26996
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25104
int get_value() const noexcept
Getter for member variable Boolean::value.
Definition: all.hpp:1857
bool is_constant_block() const noexcept override
Check if the ast node is an instance of ast::ConstantBlock.
Definition: all.hpp:13198
type of ast::LinEquation
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15802
std::shared_ptr< Name > name2
TODO.
Definition: all.hpp:23709
type of ast::FirstLastTypeIndex
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5215
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1651
std::shared_ptr< StatementBlock > finalize_block
Statement block to be executed after calling newton solver.
Definition: all.hpp:30781
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable Argument::name.
Definition: all.hpp:3022
WrappedExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:31547
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18756
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28354
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17074
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6660
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2441
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25363
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5438
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable BreakpointBlock::statement_block.
Definition: all.hpp:11102
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13719
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3037
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21703
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22343
UnitDef * clone() const override
Return a copy of the current node.
Definition: all.hpp:18233
bool is_argument() const noexcept override
Check if the ast node is an instance of ast::Argument.
Definition: all.hpp:2934
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16861
ConstantVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:14915
std::shared_ptr< Expression > rhs
TODO.
Definition: all.hpp:16536
void negate() override
Negate the value of current ast node.
Definition: all.hpp:1259
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25583
symtab::ModelSymbolTable model_symtab
global symbol table for model
Definition: all.hpp:30213
Represents a PARAMETER block in the NMODL.
Definition: all.hpp:5582
type of ast::KineticBlock
bool is_integer() const noexcept override
Check if the ast node is an instance of ast::Integer.
Definition: all.hpp:1106
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:229
bool is_first_last_type_index() const noexcept override
Check if the ast node is an instance of ast::FirstLastTypeIndex.
Definition: all.hpp:17220
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable Match::expression.
Definition: all.hpp:17898
QueueExpressionType * clone() const override
Return a copy of the current node.
Definition: all.hpp:17634
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12937
type of ast::SolutionExpression
bool is_mutex_lock() const noexcept override
Check if the ast node is an instance of ast::MutexLock.
Definition: all.hpp:24362
const std::shared_ptr< Expression > & get_lhs() const noexcept
Getter for member variable BinaryExpression::lhs.
Definition: all.hpp:16004
std::shared_ptr< Name > byname
Name of the variable (TODO)
Definition: all.hpp:26059
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ElseIfStatement::statement_block.
Definition: all.hpp:23134
int eval() const
Return value of the ast node.
Definition: all.hpp:1275
virtual double to_double()
Definition: all.hpp:729
StatementVector::const_iterator insert_statement(StatementVector::const_iterator position, const std::shared_ptr< Statement > &n)
Insert member to statements.
Definition: all.hpp:7947
type of ast::Statement
std::string eval() const
Return enum value in string form.
Definition: all.hpp:19048
bool is_conserve() const noexcept override
Check if the ast node is an instance of ast::Conserve.
Definition: all.hpp:25077
std::shared_ptr< Expression > rhs
RHS of the binary expression.
Definition: all.hpp:15904
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12797
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31269
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23291
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9400
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15572
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27676
Represents a PLOT statement in the NMODL.
Definition: all.hpp:6792
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26107
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11115
virtual Node * clone() const override
Return a copy of the current node.
Definition: all.hpp:69
Represents a INDEPENDENT block in the NMODL.
Definition: all.hpp:6059
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20111
std::vector< std::shared_ptr< ConstantStatement > > ConstantStatementVector
Definition: ast_decl.hpp:456
bool is_function_table_block() const noexcept override
Check if the ast node is an instance of ast::FunctionTableBlock.
Definition: all.hpp:9537
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4362
bool is_expression_statement() const noexcept override
Check if the ast node is an instance of ast::ExpressionStatement.
Definition: all.hpp:21613
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18289
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15162
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7323
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28138
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11527
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2758
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8869
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:6703
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21909
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11263
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13240
Represent MUTEXUNLOCK statement in NMODL.
Definition: all.hpp:24515
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22651
UnitStateType
enum type used for UNIT_ON or UNIT_OFF state
Definition: ast_common.hpp:98
DiscreteBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9014
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30079
DiffEqExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:16163
Represents USEION statement in NMODL.
Definition: all.hpp:27175
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15608
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24114
bool is_assigned_block() const noexcept override
Check if the ast node is an instance of ast::AssignedBlock.
Definition: all.hpp:6333
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11798
std::vector< std::shared_ptr< WriteIonVar > > WriteIonVarVector
Definition: ast_decl.hpp:351
Represent WATCH statement in NMODL.
Definition: all.hpp:24035
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10415
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16660
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17801
std::shared_ptr< Number > to
TODO.
Definition: all.hpp:20516
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6446
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:371
const PlotVarVector & get_variables() const noexcept
Getter for member variable PlotDeclaration::variables.
Definition: all.hpp:21250
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11979
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5258
size_t erase_statement(std::unordered_set< Statement *> &to_be_erased)
Erase non-consecutive members to statements.
Definition: all.hpp:7922
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:17797
std::shared_ptr< Name > name
Name of the partial block.
Definition: all.hpp:9243
bool is_range_var() const noexcept override
Check if the ast node is an instance of ast::RangeVar.
Definition: all.hpp:4380
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14532
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1852
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10980
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1153
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30621
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30106
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1194
bool is_ontology_statement() const noexcept override
Check if the ast node is an instance of ast::OntologyStatement.
Definition: all.hpp:30020
type of ast::AssignedDefinition
void emplace_back_global_var(GlobalVar *n)
Add member to variables by raw pointer.
Definition: all.hpp:28380
std::shared_ptr< Unit > unit
Unit if specified.
Definition: all.hpp:10108
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable PartialBlock::name.
Definition: all.hpp:9382
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31240
std::shared_ptr< Double > value
TODO.
Definition: all.hpp:18693
InitialBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7058
SectionVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4191
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9098
Represent newton solver solution block based on Eigen.
Definition: all.hpp:30766
const std::shared_ptr< Name > & get_del2() const noexcept
Getter for member variable PartialBoundary::del2.
Definition: all.hpp:23857
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1367
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12983
std::shared_ptr< Expression > expression
Expression that is being wrapped.
Definition: all.hpp:31515
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4047
const std::shared_ptr< Number > & get_min() const noexcept
Getter for member variable NumberRange::min.
Definition: all.hpp:14565
UnaryOp get_value() const noexcept
Getter for member variable UnaryOperator::value.
Definition: all.hpp:15403
bool is_block_comment() const noexcept override
Check if the ast node is an instance of ast::BlockComment.
Definition: all.hpp:29816
StatementVector solve_statements
solve blocks to be called or generated
Definition: all.hpp:30538
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4026
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5042
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27293
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7160
StatementVector::const_iterator erase_statement(StatementVector::const_iterator first, StatementVector::const_iterator last)
Erase members to statements.
Definition: all.hpp:7911
bool is_expression() const noexcept override
Check if the ast node is an instance of ast::Expression.
Definition: all.hpp:322
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10509
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26356
virtual Number * clone() const override
Return a copy of the current node.
Definition: all.hpp:751